index.js 584 B

123456789101112131415161718192021222324252627282930313233
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#000",
  5. selectedColor: "#B608D0",
  6. list: [
  7. {
  8. pagePath: "/pages/index/index",
  9. text: "资料"
  10. },
  11. {
  12. pagePath: "/pages/recommend/recommend",
  13. text: "推荐"
  14. },
  15. {
  16. pagePath: "/pages/mine/mine",
  17. text: "我的"
  18. }
  19. ]
  20. },
  21. attached() {
  22. },
  23. methods: {
  24. switchTab(e) {
  25. const data = e.currentTarget.dataset
  26. const url = data.path
  27. wx.switchTab({ url })
  28. this.setData({
  29. selected: data.index
  30. })
  31. }
  32. }
  33. })