小程序使用自定义头部
发布于 4 年前 作者 czhang 2988 次浏览 来自 分享

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 回复
回到顶部