pages.json
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/home/index",
"style": {
"navigationBarTitleText": "home"
}
},
{
"path": "pages/message/index",
"style": {
"navigationBarTitleText": "message"
}
},
{
"path": "pages/publish/index",
"style": {
"navigationBarTitleText": "publish"
}
},
{
"path": "pages/order/index",
"style": {
"navigationBarTitleText": "order"
}
},
{
"path": "pages/mine/index",
"style": {
"navigationBarTitleText": "mine"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007aff",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"midButton": {
"width": "80px",
"height": "60px",
"text": "发布",
"iconPath": "",
"iconWidth": ""
},
"list": [
{
"pagePath": "pages/home/index",
"text": "首页",
"iconPath": "",
"selectedIconPath": ""
},
{
"pagePath": "pages/order/index",
"text": "订单",
"iconPath": "",
"selectedIconPath": ""
},
// #ifdef H5 || APP-PLUS
{
"pagePath": "pages/publish/index",
"text": "发布",
"iconPath": "",
"selectedIconPath": "",
"visible": false
},
// #endif
// #ifdef H5 || APP-PLUS
{
"pagePath": "pages/publish/index",
"text": "发布",
"iconPath": "",
"selectedIconPath": "",
"visible": false
},
// #endif
{
"pagePath": "pages/message/index",
"text": "消息",
"iconPath": "",
"selectedIconPath": ""
},
{
"pagePath": "pages/mine/index",
"text": "我的",
"iconPath": "",
"selectedIconPath": ""
}
]
},
"uniIdRouter": {}
}
App.vue
export default {
onLaunch: function() {
console.log('App Launch')
uni.onTabBarMidButtonTap(() => {
console.log('点击了中间的按钮')
uni.setTabBarStyle({
// index: 2, //这里如果能单独设置就好了
selectedColor: "#7A7E83",
color: '#007aff'
})
uni.switchTab({
url: '/pages/publish/index'
})
})
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
0 个回复