Component({ properties: { childNav: { type: Array }, tabs: { type: Array }, key: { type: String, value: 'tab1' }, monthlyType: { type: String, value: '' }, infoId: { type: String, value: '' } }, data: { submitTitleShow: false }, methods: { onTabsChange(e) { console.log('this.properties.infoId.length',this.properties.infoId.length) if (this.properties.infoId.length == 0) { const { key } = e.detail const index = this.data.tabs.map((n) => n.key).indexOf(key) this.setData({ index, }) this.triggerEvent('onTabsChange', { key: key }) console.log('key', key) return } if (this.properties.monthlyType == 'publish') { wx.showModal({ title: '', content: `当前页面内容未提交,继续操作内容将被清空,是否继续?`, confirmText: '确定', confirmColor: '#01C15C', showCancel: true, success: (res) => { if (res.confirm) { console.log('用户点击确定') const { key } = e.detail const index = this.data.tabs.map((n) => n.key).indexOf(key) this.setData({ index, }) this.triggerEvent('onTabsChange', { key: key }) console.log('key', key) } else {} } }) } else { const { key } = e.detail const index = this.data.tabs.map((n) => n.key).indexOf(key) this.setData({ index, }) this.triggerEvent('onTabsChange', { key: key }) console.log('key', key) } } } })