<u-navbar title="首頁" :bgColor="bgColor" :titleStyle='titleStyle'>
<view class="u-nav-slot" slot="left">
//左邊插槽
</view>
<view class="u-nav-slot" slot="center"> -->
<text>首頁</text>
</view>
<view class="u-nav-slot" slot="right">
//右邊插槽
</view>
</u-navbar>
<view class="content" :style="{ marginTop: height + 'px' }">
<!-- 正文內容 -->
</view>
自定義完導航欄需要動態判斷當前導航欄高度
getSystemInfo(){
let stateHeight = '';//任務欄高度
//膠囊距離頂部距離//膠囊高度
const { top , height } = wx.getMenuButtonBoundingClientRect()
wx.getSystemInfoAsync({
success: (result) => {
stateHeight = result.statusBarHeight;//狀態欄高度
let sum = ''
sum = stateHeight + height + (top - stateHeight)*2
this.setData({
height:sum + 'px'
})
},
})

