}, | }, | ||||
globalData: { | globalData: { | ||||
userInfo: null, | userInfo: null, | ||||
openid: "", | |||||
appid: "", | |||||
sessionKey: "", | |||||
suiteCode: "", | |||||
customerId: "", | |||||
openid: "", | |||||
appid: "", | |||||
sessionKey: "", | |||||
suiteCode: "", | |||||
customerId: "", | |||||
}, | }, | ||||
// mangerUrl: 'http://test2.hhrchina.com', | // mangerUrl: 'http://test2.hhrchina.com', | ||||
mangerUrl: "http://192.168.18.156", | |||||
// mangerUrl: "https://www.hhrchina.com", | |||||
// mangerUrlPath: "https://www.hhrchina.com", | |||||
mangerUrl: "http://192.168.18.156", | |||||
// mangerUrl: "https://www.hhrchina.com", | |||||
// mangerUrlPath: "https://www.hhrchina.com", | |||||
// 自定义显示tabbar | |||||
onTabBar: function (key) { | |||||
var _curPageArr = getCurrentPages(); | |||||
var _curPage = _curPageArr[_curPageArr.length - 1]; | |||||
var _pagePath = _curPage.__route__; | |||||
if (_pagePath.indexOf('/') != 0) { | |||||
_pagePath = '/' + _pagePath; | |||||
} | |||||
var tabBar = this.tabBarData[key]; | |||||
for (var i = 0; i < tabBar.list.length; i++) { | |||||
tabBar.list[i].active = false; | |||||
if (tabBar.list[i].pagePath == _pagePath) { | |||||
tabBar.list[i].active = true; // 根据页面地址设置当前页面状态 | |||||
} | |||||
} | |||||
_curPage.setData({ | |||||
tabBar: tabBar | |||||
}); | |||||
}, | |||||
}) | }) |
{ | { | ||||
"pages":[ | "pages":[ | ||||
"pages/index/index", | "pages/index/index", | ||||
"pages/logs/logs" | |||||
"pages/logs/logs", | |||||
"pages/releaseModule/index", | |||||
"pages/myModule/index", | |||||
"pages/msgModule/index" | |||||
], | ], | ||||
"usingComponents": { | "usingComponents": { | ||||
"tabBar": "/components/tabbar/tabbar" | "tabBar": "/components/tabbar/tabbar" |
data: { | data: { | ||||
list: [ | list: [ | ||||
{ | { | ||||
text: "对话", | |||||
iconPath: "/images/tabbar/tabbar_1.png", | |||||
selectedIconPath: "/images/tabbar/tabbar_1.png", | |||||
dot: true | |||||
text: "首页", | |||||
pagePath: "/pages/index/index", | |||||
iconPath: "/images/tabbar/home-bar.png", | |||||
selectedIconPath: "/images/tabbar/home-bar.png", | |||||
}, | }, | ||||
{ | { | ||||
text: "设置", | |||||
iconPath: "/images/tabbar/tabbar_2.png", | |||||
selectedIconPath: "/images/tabbar/tabbar_2.png", | |||||
badge: '99+' | |||||
} | |||||
text: "发布需求", | |||||
pagePath: "/pages/releaseModule/index", | |||||
iconPath: "/images/tabbar/release-bar.png", | |||||
selectedIconPath: "/images/tabbar/release-bar.png", | |||||
}, | |||||
{ | |||||
text: "消息", | |||||
pagePath: "/pages/releaseModule/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: { | methods: { | ||||
tabChange(e) { | tabChange(e) { | ||||
console.log('tab change--aa', e) | |||||
console.log('tab change', e) | |||||
const url = e.detail.item.pagePath; | |||||
wx.redirectTo({ url }); | |||||
// wx.navigateTo({ url }) | |||||
} | } | ||||
} | } | ||||
}) | }) |
<view class="page"> | <view class="page"> | ||||
<mp-tabbar style="position:fixed;bottom:0;width:100%;left:0;right:0;" list="{{list}}" bindchange="tabChange"></mp-tabbar> | |||||
<mp-tabbar | |||||
style="position:fixed;bottom:0;width:100%;left:0;right:0;" | |||||
list="{{list}}" | |||||
bindchange="tabChange" | |||||
current="{{currentIndex}}" | |||||
/> | |||||
</view> | </view> |
### 目录说明 | |||||
- index 首页 | |||||
- releaseModule 发布需求 | |||||
- msgModule 消息 | |||||
- myModule 我的 |
<!--index.wxml--> | <!--index.wxml--> | ||||
<view class="container"> | <view class="container"> | ||||
康慧慧V8 | |||||
康慧慧V9 | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | <tabBar currentIndex="{{currentIndex}}"></tabBar> | ||||
</view> | </view> | ||||
// pages/release/release.js | |||||
// 获取应用实例 | |||||
const app = getApp() | |||||
Page({ | |||||
data: { | |||||
currentIndex: 2 | |||||
}, | |||||
}) |
{ | |||||
"component": true, | |||||
"usingComponents": {} | |||||
} |
<!--pages/msgPage/msgPage.wxml--> | |||||
<text>pages/msgPage/msgPage.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> |
/* pages/msgPage/msgPage.wxss */ |
// pages/release/release.js | |||||
// 获取应用实例 | |||||
const app = getApp() | |||||
Page({ | |||||
data: { | |||||
currentIndex: 3 | |||||
}, | |||||
}) |
{ | |||||
"component": true, | |||||
"usingComponents": {} | |||||
} |
<!--pages/myPage/myPage.wxml--> | |||||
<text>pages/myPage/myPage.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> |
/* pages/myPage/myPage.wxss */ |
// pages/release/release.js | |||||
// 获取应用实例 | |||||
const app = getApp() | |||||
Page({ | |||||
data: { | |||||
currentIndex: 1 | |||||
}, | |||||
}) |
{ | |||||
"component": true, | |||||
"usingComponents": {} | |||||
} |
<!--pages/release/release.wxml--> | |||||
<text>pages/release/release.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> |
/* pages/release/release.wxss */ |