小程序使用自定义头部

发布于 5 年前作者 czhang3146 次浏览最后编辑 5 年前来自 share

wxml部分:

<view< span=“”> class=“custom-title” style=“top: {{top}}; height: {{height}}; line-height: {{height}}”> {{title}} view></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
// 获取状态栏相关结束
1 回复
yiming
yiming1 楼4 年前