Component({ /** * 组件的属性列表 */ properties: { /* 列表 */ tabsList: { type: Array }, /* 下标 */ tabsIndex: { type: Number, value: 0 }, /* 回调 */ setIndex: { type: Function } }, /** * 组件的初始数据 */ data: {}, /** * 组件的方法列表 */ methods: { setTabsIndex(e) { const { index } = e.target.dataset; this.setData({ tabsIndex: index }) this.triggerEvent("setIndex", index) } } })