// components/tabbar/tabbar.js const app = getApp() Component({ /** * 组件的属性列表 */ properties: { currentIndex: { type: String, value: '0', } }, /** * 组件的初始数据 */ data: { list: [ { text: "首页", pagePath: "/pages/index/index", iconPath: "/images/tabbar/home-bar.png", selectedIconPath: "/images/tabbar/home-bar.png", }, { text: "发布需求", pagePath: "/pages/releaseModule/index", iconPath: "/images/tabbar/release-bar.png", selectedIconPath: "/images/tabbar/release-bar.png", }, { text: "消息", pagePath: "/pages/msgModule/index", iconPath: "/images/tabbar/msg-bar.png", selectedIconPath: "/images/tabbar/msg-bar.png", }, { text: "我的", pagePath: "/pages/myModule/index", iconPath: "/images/tabbar/my-bar.png", selectedIconPath: "/images/tabbar/my-bar.png", }, ] }, /** * 组件的方法列表 */ methods: { tabChange(e) { if (e.detail.item.text == "发布需求" || e.detail.item.text == "消息") { if (!app.globalData.customerId) { app.goLogin(); return } } const url = e.detail.item.pagePath; wx.redirectTo({ url }); } } })