<view class="navTop" style='padding-top:{{navtop}}px;'>头部</view>
.navTop{
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
color: rgba(255,255,255,.8);
font-size: 34rpx;
position: fixed;
top: 0;
left: 0;
}
data:{
navtop:''
},
onLoad(){
let windowWidth = wx.getSystemInfoSync().windowWidth;
const statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
const menuButton = wx.getMenuButtonBoundingClientRect();
let navHeight = (menuButton.height + (menuButton.top - statusBarHeight) * 2) * (750 / windowWidth);
let statusBarTop = statusBarHeight * (750 / windowWidth);
this.setData({
navtop:menuButton.top
})
}