业务交流通
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

tabbar.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // components/tabbar/tabbar.js
  2. const app = getApp()
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. currentIndex: {
  9. type: String,
  10. value: '0',
  11. }
  12. },
  13. /**
  14. * 组件的初始数据
  15. */
  16. data: {
  17. list: [
  18. {
  19. text: "首页",
  20. pagePath: "/pages/index/index",
  21. iconPath: "/images/tabbar/home-bar.png",
  22. selectedIconPath: "/images/tabbar/home-bar.png",
  23. },
  24. {
  25. text: "发布需求",
  26. pagePath: "/pages/releaseModule/index",
  27. iconPath: "/images/tabbar/release-bar.png",
  28. selectedIconPath: "/images/tabbar/release-bar.png",
  29. },
  30. {
  31. text: "消息",
  32. pagePath: "/pages/msgModule/index",
  33. iconPath: "/images/tabbar/msg-bar.png",
  34. selectedIconPath: "/images/tabbar/msg-bar.png",
  35. },
  36. {
  37. text: "我的",
  38. pagePath: "/pages/myModule/index",
  39. iconPath: "/images/tabbar/my-bar.png",
  40. selectedIconPath: "/images/tabbar/my-bar.png",
  41. },
  42. ]
  43. },
  44. /**
  45. * 组件的方法列表
  46. */
  47. methods: {
  48. tabChange(e) {
  49. if (e.detail.item.text == "发布需求" || e.detail.item.text == "消息") {
  50. if (!app.globalData.customerId) {
  51. app.goLogin();
  52. return
  53. }
  54. }
  55. const url = e.detail.item.pagePath;
  56. wx.redirectTo({ url });
  57. }
  58. }
  59. })