index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // custom-tab-bar/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. },
  8. /**
  9. * 组件的初始数据
  10. */
  11. data: {
  12. selected: 0,
  13. "color": "#969696",
  14. "selectedColor": "#0C6E4D",
  15. "backgroundColor": "#FFFFFF",
  16. "borderStyle": "black",
  17. "list": [{
  18. "pagePath": "/pages/index/sola/index.js",
  19. "text": "首页",
  20. "iconPath": "/icon/index.png",
  21. "selectedIconPath": "/icon/index-select.png"
  22. },
  23. {
  24. "pagePath": "/pages/stamp/stamp.js",
  25. "text": "邮品",
  26. "iconPath": "/icon/stamp.png",
  27. "selectedIconPath": "/icon/stamp-select.png"
  28. },
  29. {
  30. "pagePath": "/pages/me/me.js",
  31. "text": "我的",
  32. "iconPath": "/icon/me.png",
  33. "selectedIconPath": "/icon/me-select.png"
  34. }
  35. ]
  36. },
  37. /**
  38. * 组件的方法列表
  39. */
  40. methods: {
  41. switchTab(e) {
  42. const data = e.currentTarget.dataset
  43. const url = data.path
  44. wx.switchTab({url})
  45. this.setData({
  46. selected: data.index
  47. })
  48. }
  49. }
  50. })