index.js 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // components/My_user_right/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. option:{
  8. type:Function
  9. }
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. /* 列表 */
  16. list:[
  17. {
  18. id:"001",
  19. value:"管理员"
  20. },
  21. {
  22. id:"002",
  23. value:"店长"
  24. },{
  25. id:"003",
  26. value:"店员"
  27. },{
  28. id:"004",
  29. value:"游客"
  30. },
  31. ],
  32. indexSelect:0,//选项下标
  33. },
  34. /**
  35. * 组件的方法列表
  36. */
  37. methods: {
  38. /* 切换选项 */
  39. itemChenge(e){
  40. const {index}=e.target.dataset
  41. this.triggerEvent("option",this.data.list[index])
  42. this.setData({
  43. indexSelect:index
  44. })
  45. }
  46. }
  47. })