// pages/components/statusBar/statusBar.js Component({ /** * 组件的属性列表 */ properties: { showBackTop: Boolean, title: String }, /** * 组件的初始数据 */ data: { showBack: true }, /** * 组件的方法列表 */ methods: { /** * *返回上一级 * * @param {*} e */ _backPage(e) { wx.navigateBack() }, }, lifetimes: { attached: function () { wx.getSystemInfo({ success: (res) => { const isiOS = res.system.indexOf('iOS') > -1; this.setData({ navHeight: isiOS ? 44 : 48, statusBarHeight: res.statusBarHeight, windowHeight: res.windowHeight, windowWidth: res.windowWidth, }) } }) // wx.getSystemInfo({ // success: (res) => { // const isiOS = res.system.indexOf('iOS') > -1; // this.setData({ // navHeight: isiOS ? 44 : 48, // statusBarHeight: res.statusBarHeight, // windowHeight: res.windowHeight, // windowWidth: res.windowWidth, // }) // } // }) }, }, pageLifetimes: { show: function () { if (getCurrentPages().length <= 1) { this.setData({ showBack: false }) } }, } })