init
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
const __templateJs = require("./templates.js");
|
||||
const __mergePageOptions = require("../../util/mergePageOptions.js");
|
||||
Page(__mergePageOptions({
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '设置页面标题',
|
||||
path: 'packageAPI/pages/set-navigation-bar-title/set-navigation-bar-title'
|
||||
};
|
||||
},
|
||||
data: {
|
||||
apiData: {
|
||||
content: '',
|
||||
success: false,
|
||||
fail: false,
|
||||
complete: false
|
||||
}
|
||||
},
|
||||
resetApiData() {
|
||||
this.setData({
|
||||
apiData: {
|
||||
success: false,
|
||||
fail: false,
|
||||
complete: false,
|
||||
content: ''
|
||||
}
|
||||
});
|
||||
},
|
||||
updateApiData(type, content) {
|
||||
const apiData = {
|
||||
...this.data.apiData
|
||||
};
|
||||
apiData[type] = true;
|
||||
apiData.content = content;
|
||||
this.setData({
|
||||
apiData
|
||||
});
|
||||
},
|
||||
handleTitle(e) {
|
||||
this.setData({
|
||||
title: e.detail.value
|
||||
});
|
||||
},
|
||||
setNaivgationBarTitle() {
|
||||
xhs.setNavigationBarTitle({
|
||||
title: this.data.title,
|
||||
success: res => {
|
||||
this.updateApiData('success', res);
|
||||
},
|
||||
fail: res => {
|
||||
this.updateApiData('fail', res);
|
||||
},
|
||||
complete: res => {
|
||||
this.updateApiData('complete', res);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}, __templateJs));
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "设置页面标题",
|
||||
"usingComponents": {
|
||||
"showbox": "../../common/component/showbox/index",
|
||||
"box": "../../common/component/container/index",
|
||||
"api-status": "../../common/component/api-status/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<view class="container">
|
||||
<showbox title="设置页面标题">
|
||||
<box>
|
||||
<view class="_ui-space">
|
||||
<view class="_ui-input">
|
||||
<input bindinput="handleTitle" type="text" placeholder="请输入页面标题并点击设置即可" name="title"></input>
|
||||
</view>
|
||||
<button class="_ui-button" hover-class="_ui-button-hover" type="primary" bindtap="setNaivgationBarTitle">设置</button>
|
||||
</view>
|
||||
</box>
|
||||
</showbox>
|
||||
</view>
|
||||
<include src="templates.xhsml" />
|
||||
111
xhs-mini-demos/api-case/set-navigation-bar-title/templates.js
Normal file
111
xhs-mini-demos/api-case/set-navigation-bar-title/templates.js
Normal file
@@ -0,0 +1,111 @@
|
||||
/** 以下内容为自动生成,请勿手动修改 */
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
page_data_0: "",
|
||||
|
||||
page_data_1: "",
|
||||
|
||||
page_data_2: "",
|
||||
|
||||
page_data_3: false,
|
||||
|
||||
page_data_4: false,
|
||||
|
||||
page_data_5: false,
|
||||
|
||||
page_data_6: "",
|
||||
|
||||
page_data_7: "",
|
||||
|
||||
page_data_8: false,
|
||||
|
||||
page_data_9: false,
|
||||
|
||||
page_data_10: false,
|
||||
|
||||
page_data_11: "",
|
||||
},
|
||||
|
||||
page_fun_1(e) {
|
||||
this.setData("page_data_0", e.detail.value);
|
||||
},
|
||||
|
||||
page_fun_2(e) {
|
||||
this.setData("page_data_1", e.detail.value);
|
||||
},
|
||||
|
||||
page_fun_3(e) {
|
||||
this.setData("page_data_2", e.detail.value);
|
||||
},
|
||||
|
||||
page_fun_0() {
|
||||
this.setData({
|
||||
page_data_3: false,
|
||||
page_data_4: false,
|
||||
page_data_5: false,
|
||||
});
|
||||
|
||||
xhs.setNavigationBarColor({
|
||||
success: (res) => {
|
||||
console.log("success", res);
|
||||
this.setData({
|
||||
page_data_3: true,
|
||||
page_data_6: JSON.stringify(res),
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log("fail", res);
|
||||
this.setData({
|
||||
page_data_4: true,
|
||||
page_data_6: JSON.stringify(res),
|
||||
});
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log("complete", res);
|
||||
this.setData({
|
||||
page_data_5: true,
|
||||
});
|
||||
},
|
||||
frontColor: this.data.page_data_0,
|
||||
backgroundColor: this.data.page_data_1,
|
||||
animation: this.data.page_data_2,
|
||||
});
|
||||
},
|
||||
|
||||
page_fun_5(e) {
|
||||
this.setData("page_data_7", e.detail.value);
|
||||
},
|
||||
|
||||
page_fun_4() {
|
||||
this.setData({
|
||||
page_data_8: false,
|
||||
page_data_9: false,
|
||||
page_data_10: false,
|
||||
});
|
||||
|
||||
xhs.setNavigationBarTitle({
|
||||
success: (res) => {
|
||||
console.log("success", res);
|
||||
this.setData({
|
||||
page_data_8: true,
|
||||
page_data_11: JSON.stringify(res),
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log("fail", res);
|
||||
this.setData({
|
||||
page_data_9: true,
|
||||
page_data_11: JSON.stringify(res),
|
||||
});
|
||||
},
|
||||
complete: (res) => {
|
||||
console.log("complete", res);
|
||||
this.setData({
|
||||
page_data_10: true,
|
||||
});
|
||||
},
|
||||
title: this.data.page_data_7,
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
<!-- 以下内容为自动生成,请勿手动修改 -->
|
||||
|
||||
<view class="container">
|
||||
<showbox title="setNavigationBarColor演示">
|
||||
<box>
|
||||
<api-status
|
||||
success="{{page_data_3}}"
|
||||
complete="{{page_data_5}}"
|
||||
fail="{{page_data_4}}"
|
||||
text="{{page_data_6}}"
|
||||
>
|
||||
</api-status>
|
||||
<view class="_ui-space _mt8">
|
||||
<view class="_ui-input">
|
||||
<input placeholder="frontColor" type="text" bindinput="page_fun_1" />
|
||||
</view>
|
||||
|
||||
<view class="_ui-input">
|
||||
<input
|
||||
placeholder="backgroundColor"
|
||||
type="text"
|
||||
bindinput="page_fun_2"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="_ui-input">
|
||||
<input placeholder="animation" type="text" bindinput="page_fun_3" />
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="_ui-button"
|
||||
hover-class="_ui-button-hover"
|
||||
bindtap="page_fun_0"
|
||||
>
|
||||
触发
|
||||
</button>
|
||||
</view>
|
||||
</box>
|
||||
</showbox>
|
||||
|
||||
<showbox title="setNavigationBarTitle演示">
|
||||
<box>
|
||||
<api-status
|
||||
success="{{page_data_8}}"
|
||||
complete="{{page_data_10}}"
|
||||
fail="{{page_data_9}}"
|
||||
text="{{page_data_11}}"
|
||||
>
|
||||
</api-status>
|
||||
<view class="_ui-space _mt8">
|
||||
<view class="_ui-input">
|
||||
<input placeholder="title" type="text" bindinput="page_fun_5" />
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="_ui-button"
|
||||
hover-class="_ui-button-hover"
|
||||
bindtap="page_fun_4"
|
||||
>
|
||||
触发
|
||||
</button>
|
||||
</view>
|
||||
</box>
|
||||
</showbox>
|
||||
</view>
|
||||
Reference in New Issue
Block a user