const app = getApp() Component({ properties: { active: { type: String, value: 'home' }, themeMode: { type: String, value: 'light' }, tabs: { type: Array, value: [ { key: 'home', label: '打卡', icon: '📋' }, { key: 'feed', label: '广场', icon: '🌊' }, { key: 'profile', label: '我的', icon: '👤' }, ], }, }, lifetimes: { attached() { this.setData({ themeMode: app.globalData.themeMode }) }, }, methods: { onSwitch(e) { this.triggerEvent('switch', { key: e.currentTarget.dataset.key }) } } })