index.js 701 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Component({
  2. /**
  3. * 组件的属性列表
  4. */
  5. properties: {
  6. /* 列表 */
  7. tabsList: {
  8. type: Array
  9. },
  10. /* 下标 */
  11. tabsIndex: {
  12. type: Number,
  13. value: 0
  14. },
  15. /* 回调 */
  16. setIndex: {
  17. type: Function
  18. }
  19. },
  20. /**
  21. * 组件的初始数据
  22. */
  23. data: {},
  24. /**
  25. * 组件的方法列表
  26. */
  27. methods: {
  28. setTabsIndex(e) {
  29. const {
  30. index
  31. } = e.target.dataset;
  32. this.setData({
  33. tabsIndex: index
  34. })
  35. this.triggerEvent("setIndex", index)
  36. }
  37. }
  38. })