index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // custom-tab-bar/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. },
  8. /**
  9. * 组件的初始数据
  10. */
  11. data: {
  12. selected: 0,
  13. color: "#999999",
  14. selectedColor: "#32CA69",
  15. listTab: [{
  16. "pagePath": "/pages/index/index",
  17. "text": "推荐",
  18. "iconPath": "/static/tj.png",
  19. "selectedIconPath": "/static/tj2.png"
  20. }, {
  21. "pagePath": "/pages/activity/index",
  22. "text": "活动",
  23. "iconPath": "/static/activity.png",
  24. "selectedIconPath": "/static/activity2.png"
  25. }, {
  26. "pagePath": "/pages/works/index",
  27. "text": "作品",
  28. "iconPath": "/static/zp.png",
  29. "selectedIconPath": "/static/zp2.png"
  30. }, {
  31. "pagePath": "/pages/my/index",
  32. "text": "我的",
  33. "iconPath": "/static/my.png",
  34. "selectedIconPath": "/static/my2.png"
  35. }]
  36. },
  37. /**
  38. * 组件的方法列表
  39. */
  40. methods: {
  41. switchTab(e) {
  42. const data = e.currentTarget.dataset;
  43. const url = data.path;
  44. wx.switchTab({
  45. url
  46. });
  47. }
  48. }
  49. })