1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- // 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) {
- console.log(e);
- if (e.detail.item.text == "发布需求" || e.detail.item.text == "消息") {
- if (!app.globalData.customerId) {
- app.goLogin();
- this.setData({
- currentIndex: this.data.currentIndex
- })
- return
- }
- }
-
- const url = e.detail.item.pagePath;
- // wx.redirectTo({ url });
- wx.navigateTo({
- url,
- // success: function (res) {
- // // 通过eventChannel向被打开页面传送数据
- // res.eventChannel.emit('customerid', { customerid })
- // }
- })
- }
- }
- })
|