This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,87 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '设置TabBarItem',
path: 'packageAPI/pages/set-tab-bar-item/set-tab-bar-item'
};
},
data: {
index: 0,
text: 'newText',
iconPath: 'https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/baobaozhidao@2x-af409f9dbe.png',
selectedIconPath: 'https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/topnav/yinyue@2x-c18adacacb.png'
},
handleIndex(e) {
this.setData({
index: e.detail.value
});
},
handleText(e) {
this.setData({
text: e.detail.value
});
},
handleIconPath(e) {
this.setData({
iconPath: e.detail.value
});
},
handleSelectIconPath(e) {
this.setData({
selectedIconPath: e.detail.value
});
},
setTabBarItem() {
xhs.navigateBack({
success: () => {
xhs.setTabBarItem({
index: this.data.index,
text: this.data.text,
iconPath: this.data.iconPath,
selectedIconPath: this.data.selectedIconPath,
success: res => {
xhs.showToast({
title: '设置成功',
icon: 'node'
});
},
fail: res => {}
});
}
});
},
showTabBar() {
xhs.navigateBack({
success: () => {
xhs.showTabBar({
animation: true,
success: res => {},
fail: res => {}
});
}
});
},
hideTabBar() {
xhs.navigateBack({
success: () => {
xhs.hideTabBar({
success: res => {},
fail: res => {}
});
}
});
},
hideTabBarAnimate() {
xhs.navigateBack({
success: () => {
xhs.hideTabBar({
animation: true,
success: res => {},
fail: res => {}
});
}
});
}
}, __templateJs));

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "设置TabBar",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,24 @@
<view class="container">
<showbox title="设置TabBar">
<box>
<view class="_ui-space">
<view class="_ui-input">
<input type="text" placeholder="tabBar索引(从0开始)" bindinput="handleIndex"/>
</view>
<view class="_ui-input">
<input type="text" placeholder="tabBar文字" bindinput="handleText"/>
</view>
<view class="_ui-input">
<input type="text" placeholder="tabBar未选中图片地址" bindinput="handleIconPath"/>
</view>
<view class="_ui-input">
<input type="text" placeholder="tabBar选中图片地址" bindinput="handleSelectIconPath"/>
</view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="setTabBarItem">设置</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="showTabBar">显示tabBar</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="hideTabBarAnimate">隐藏tabBar</button>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,72 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: "",
page_data_1: "",
page_data_2: "",
page_data_3: "",
page_data_4: false,
page_data_5: false,
page_data_6: false,
page_data_7: "",
},
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_4(e) {
this.setData("page_data_3", e.detail.value);
},
page_fun_0() {
this.setData({
page_data_4: false,
page_data_5: false,
page_data_6: false,
});
xhs.setTabBarItem({
success: (res) => {
console.log("success", res);
this.setData({
page_data_4: true,
page_data_7: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_5: true,
page_data_7: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_6: true,
});
},
index: this.data.page_data_0,
text: this.data.page_data_1,
iconPath: this.data.page_data_2,
selectedIconPath: this.data.page_data_3,
});
},
};

View File

@@ -0,0 +1,44 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="setTabBarItem演示">
<box>
<api-status
success="{{page_data_4}}"
complete="{{page_data_6}}"
fail="{{page_data_5}}"
text="{{page_data_7}}"
>
</api-status>
<view class="_ui-space _mt8">
<view class="_ui-input">
<input placeholder="index" type="text" bindinput="page_fun_1" />
</view>
<view class="_ui-input">
<input placeholder="text" type="text" bindinput="page_fun_2" />
</view>
<view class="_ui-input">
<input placeholder="iconPath" type="text" bindinput="page_fun_3" />
</view>
<view class="_ui-input">
<input
placeholder="selectedIconPath"
type="text"
bindinput="page_fun_4"
/>
</view>
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
</view>