// components/My_user_right/index.js Component({ /** * 组件的属性列表 */ properties: { option:{ type:Function } }, /** * 组件的初始数据 */ data: { /* 列表 */ list:[ { id:"001", value:"管理员" }, { id:"002", value:"店长" },{ id:"003", value:"店员" },{ id:"004", value:"游客" }, ], indexSelect:0,//选项下标 }, /** * 组件的方法列表 */ methods: { /* 切换选项 */ itemChenge(e){ const {index}=e.target.dataset this.triggerEvent("option",this.data.list[index]) this.setData({ indexSelect:index }) } } })