index.js 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Component({
  2. data: {
  3. selected: 0,
  4. color: "#7A7E83",
  5. selectedColor: "#3cc51f",
  6. list: [
  7. {
  8. pagePath: "/pages/index/index",
  9. text: "首页",
  10. iconPath: "/images/home.png",
  11. selectedIconPath: "/images/home_b.png"
  12. },
  13. {
  14. pagePath: "/pages/indexcate/indexcate",
  15. text: "发现",
  16. iconPath: "/images/more2.png",
  17. selectedIconPath: "/images/more2_b.png"
  18. },
  19. {
  20. pagePath: "/pages/mycenter/mycenter",
  21. text: "我的",
  22. iconPath: "/images/my.png",
  23. selectedIconPath: "/images/my_b.png"
  24. }
  25. ]
  26. },
  27. methods: {
  28. switchTab(e) {
  29. console.log(e)
  30. let data = e.currentTarget.dataset
  31. let url = data.path
  32. wx.switchTab({
  33. url
  34. })
  35. this.setData({
  36. selected: data.index
  37. })
  38. console.log(url, this.data.selected, '111')
  39. }
  40. }
  41. })