const app = getApp(); Component({ options: { addGlobalClass: true }, properties: { title: { type: String, value: '肉垫计划' }, showBack: { type: Boolean, value: false }, // tone="brand":透明底 + 深棕字,压在品牌色带上(首页/记录页)。 // 默认空 = 原来的奶白毛玻璃,另外 7 个页面都靠它,别动默认分支 tone: { type: String, value: '' } }, data: { statusBarHeight: 20, navBarHeight: 44 }, lifetimes: { attached() { this.setData({ statusBarHeight: app.globalData.statusBarHeight, navBarHeight: app.globalData.navBarHeight }); } }, methods: { onBack() { const pages = getCurrentPages(); if (pages.length > 1) { wx.navigateBack(); } else { wx.switchTab({ url: '/pages/home/home' }); } } } });