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,73 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '设置TabBarStyle',
path: 'packageAPI/pages/set-tab-bar-style/set-tab-bar-style'
};
},
data: {
color: '#0000ff',
selectedColor: '#ff0000',
backgroundColor: '#00ff00',
borderStyle: 'black'
},
handleColor(e) {
this.setData({
color: e.detail.value
});
},
handleSelectColor(e) {
this.setData({
selectedColor: e.detail.value
});
},
handleBackgroundColor(e) {
this.setData({
backgroundColor: e.detail.value
});
},
handleBorderStyle(e) {
this.setData({
borderStyle: e.detail.value
});
},
setTabBarStyle() {
xhs.navigateBack({
success: () => {
xhs.setTabBarStyle({
color: this.data.color,
selectedColor: this.data.selectedColor,
backgroundColor: this.data.backgroundColor,
borderStyle: this.data.borderStyle,
success: res => {
xhs.showToast({
title: '设置成功',
icon: 'none'
});
},
fail: res => {}
});
}
});
},
reBack() {
xhs.navigateBack({
success: () => {
xhs.setTabBarStyle({
color: 'rgba(51, 51, 51, 0.4)',
selectedColor: '#ff0000',
backgroundColor: '#ffffff',
success: res => {
xhs.showToast({
title: '设置成功',
icon: 'none'
});
},
fail: res => {}
});
}
});
}
}, __templateJs));

View File

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

View File

@@ -0,0 +1,23 @@
<view class="container">
<showbox title="设置TabBarStyle">
<box>
<view class="_ui-space">
<view class="_ui-input">
<input class="input" type="text" placeholder="默认文字颜色:{{'默认:' + color + '(蓝色)'}}" bindinput="handleColor" />
</view>
<view class="_ui-input">
<input class="input" type="text" placeholder="选中文字颜色:{{'默认:' + selectedColor + '(红色)'}}" bindinput="handleSelectColor" />
</view>
<view class="_ui-input">
<input class="input" type="text" placeholder="背景颜色:{{'默认:' + backgroundColor + '(绿色)'}}" bindinput="handleBackgroundColor" />
</view>
<view class="_ui-input">
<input class="input" type="text" placeholder="tabBar边框颜色{{'仅black(默认)或white'}}" bindinput="handleBorderStyle" />
</view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="setTabBarStyle">设置</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="reBack">恢复</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.setTabBarStyle({
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,
});
},
color: this.data.page_data_0,
selectedColor: this.data.page_data_1,
backgroundColor: this.data.page_data_2,
borderStyle: this.data.page_data_3,
});
},
};

View File

@@ -0,0 +1,48 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="setTabBarStyle演示">
<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="color" type="text" bindinput="page_fun_1" />
</view>
<view class="_ui-input">
<input
placeholder="selectedColor"
type="text"
bindinput="page_fun_2"
/>
</view>
<view class="_ui-input">
<input
placeholder="backgroundColor"
type="text"
bindinput="page_fun_3"
/>
</view>
<view class="_ui-input">
<input placeholder="borderStyle" 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>