index.js 642 B

123456789101112131415161718192021222324252627282930
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#7A7E83",
  5. selectedColor: "#3cc51f",
  6. list: [{
  7. pagePath: "/index/index",
  8. iconPath: "/image/icon_component.png",
  9. selectedIconPath: "/image/icon_component_HL.png",
  10. text: "组件"
  11. }, {
  12. pagePath: "/index/index2",
  13. iconPath: "/image/icon_API.png",
  14. selectedIconPath: "/image/icon_API_HL.png",
  15. text: "接口"
  16. }]
  17. },
  18. attached() {
  19. },
  20. methods: {
  21. switchTab(e) {
  22. const data = e.currentTarget.dataset
  23. const url = data.path
  24. wx.switchTab({url})
  25. this.setData({
  26. selected: data.index
  27. })
  28. }
  29. }
  30. })