1. 全局、局部導(dǎo)航欄和狀態(tài)欄配置
參考官網(wǎng):https://uniapp.dcloud.io/collocation/pages.html
{ // 局部
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTextStyle": "white", // 導(dǎo)航欄標(biāo)題顏色及狀態(tài)欄前景顏色变秦,僅支持 black/white,默認(rèn)值:white
"navigationBarTitleText": "頁面自定義標(biāo)題", // 導(dǎo)航欄標(biāo)題文字內(nèi)容
"navigationBarBackgroundColor": "#028939", // 導(dǎo)航欄背景顏色(同狀態(tài)欄背景色)盲再,默認(rèn)值:#F7F7F7
"backgroundColor": "#F8F8F8" // 下拉顯示出來的窗口的背景色周崭,默認(rèn)值:#ffffff
}
}
],
// 全局配置
"globalStyle": {
"navigationBarTextStyle": "black", // 導(dǎo)航欄標(biāo)題顏色及狀態(tài)欄前景顏色哑诊,僅支持 black/white撒璧,默認(rèn)值:white
"navigationBarTitleText": "全局默認(rèn)自定義標(biāo)題", // 導(dǎo)航欄標(biāo)題文字內(nèi)容
"navigationBarBackgroundColor": "#F8F8F8", // 導(dǎo)航欄背景顏色(同狀態(tài)欄背景色)透葛,默認(rèn)值:#F7F7F7
"backgroundColor": "#F8F8F8" // 下拉顯示出來的窗口的背景色,默認(rèn)值:#ffffff
}
}
2. 手動(dòng)設(shè)置局部導(dǎo)航欄
methods: {
setTitleText() {
uni.setNavigationBarTitle({
title: "導(dǎo)航欄文字設(shè)置"
})
},
setTitleBackground() {
uni.setNavigationBarColor({
frontColor: "#ffffff", // 導(dǎo)航欄文字設(shè)置
backgroundColor: "#007AFF"http:// 導(dǎo)航欄背景色設(shè)置
})
}
}