const app = getApp() Component({ properties: { active: { type: Number, value: 0 }, tabList: { type: Array, value: [ { title: '报名中', active: 0 }, { title: '未开始', active: 1 }, { title: '进行中', active: 2 }, { title: '已结束', active: 3 } ] }, }, data: {}, methods: { //滑动切换 swiperTab: function (e) { const that = this; that.triggerEvent('swiperTab', { active: e.detail.current }) }, //点击切换 clickTab: function (e) { const that = this; if (that.data.active === e.target.dataset.active) return false else that.setData({ active: e.target.dataset.active }) that.triggerEvent('clickTab', { active: e.target.dataset.active }) }, } })