tabs.js 704 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // const getReq = require('./../../../config.js').getReq
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. tabs: {
  8. type: Array
  9. }
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. secIndex: 0
  16. },
  17. ready() {
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. methods: {
  23. secTabs: function (e) {
  24. let secIndex = e.currentTarget.dataset.id
  25. if (secIndex == this.data.secIndex) {
  26. return
  27. }
  28. let item = e.currentTarget.dataset.item
  29. this.setData({
  30. secIndex
  31. })
  32. var myEventDetail = { item } // detail对象,提供给事件监听函数
  33. this.triggerEvent('myevent', myEventDetail)
  34. }
  35. }
  36. })