// nova-tourism/components/my/index.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { statusBarHeight: 0, screenHeight: 0, customHeight: 0, bottomNavHeight: 0, contentHeight: 0, }, lifetimes: { detached: function () {}, attached: async function () { const systemInfo = wx.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 0; const screenHeight = systemInfo.screenHeight || 0; const custom = wx.getMenuButtonBoundingClientRect(); const customHeight = custom.height + 10 + 2 || 0; const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0; const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth; this.setData({ statusBarHeight, screenHeight, customHeight, bottomNavHeight, contentHeight }); }, }, /** * 组件的方法列表 */ methods: { gourl(e) { const url = e.currentTarget.dataset.url; wx.navigateTo({ url: `${url}`, }); }, } })