wxml部分:
<view class="custom-title" style="top: {{top}}; height: {{height}}; line-height: {{height}}"> {{title}} </view>
js部分:
data: {
title: "",
top: app.globalData.top + 'px',
height: app.globalData.height + 'px'
}
// 获取状态栏相关开始
var menu = wx.getMenuButtonBoundingClientRect()
this.globalData.top = menu.top
this.globalData.height = menu.height
// 获取状态栏相关结束
?