const App = getApp(); Component({ properties: { isBack: { type: Boolean, default: false }, text: { type: String, default: "" } }, data: { statusHeight: 0, navigationHeight: 0, agencyName: '', leftWidth: 0, iconWidth: 0, }, lifetimes: { ready: function () { this.setData({ statusHeight: App.globalData.deviceInfo.statusHeight, navigationHeight: App.globalData.deviceInfo.navigationHeight, agencyName: App.globalData.user.agencyName, }) const menuButton = wx.getMenuButtonBoundingClientRect(); console.log(menuButton) this.setData({ leftWidth: menuButton.left, iconWidth: menuButton.width, }) }, }, methods: { back() { wx.navigateBack({ delta: 1 }) }, getNavigationInfo: function () { var that = this; wx.getSystemInfo({ success (res) { } }) } } });