业务交流通
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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. console.log(e);
  50. if (e.detail.item.text == "发布需求" || e.detail.item.text == "消息") {
  51. if (!app.globalData.customerId) {
  52. app.goLogin();
  53. this.setData({
  54. currentIndex: this.data.currentIndex
  55. })
  56. return
  57. }
  58. }
  59. const url = e.detail.item.pagePath;
  60. // wx.redirectTo({ url });
  61. wx.navigateTo({
  62. url,
  63. // success: function (res) {
  64. // // 通过eventChannel向被打开页面传送数据
  65. // res.eventChannel.emit('customerid', { customerid })
  66. // }
  67. })
  68. }
  69. }
  70. })