通過設置navigationStyle, 即自定義導航實現背景全屏
參考文章: 微信小程序 自定義頭部導航欄 navigationStyle
代碼部分
在page.json中, 加入 "navigationStyle": "custom" , 這是全局的, 單頁面的還不知道怎么搞
"globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "知識問答系統", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", "navigationStyle": "custom" }
然后背景全屏代碼部分, 首先需要容器占滿屏幕
<view class="background" :style = ' { backgroundImage : " url(" + setting.login_background + " ) " } '>
onReady() { let systemInfo = uni.getSystemInfoSync() this.height = systemInfo.windowHeight },