tabs.js 799 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Component({
  3. ready: function () {
  4. if (!this.data.tabList.length)
  5. return;
  6. var id = this.data.tabList[0].id;
  7. this.setData({
  8. tab: id
  9. });
  10. this.triggerEvent('change', id);
  11. },
  12. properties: {
  13. list: {
  14. type: Array,
  15. value: []
  16. }
  17. },
  18. data: {
  19. tab: 0,
  20. tabList: [
  21. {
  22. title: "剪辑",
  23. number: 0,
  24. id: 0
  25. },
  26. ]
  27. },
  28. methods: {
  29. clickTab: function () {
  30. var _this = this;
  31. var tabData = arguments[0].currentTarget.dataset;
  32. this.setData({ tab: tabData.id }, function () { return _this.triggerEvent("Change", tabData.id); });
  33. }
  34. }
  35. });