!!不支持wx小程序,需要自定义tabbar(指路官方文档)https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html
1.配置pages.json
"tabBar": {
"custom": true, // 启用自定义tabBar -------------1
"color": "#7A7E83",
"selectedColor": "#007afe",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"iconPath": "static/tabbar/home1.png",
"selectedIconPath": "static/tabbar/home2.png",
"pagePath": "pages/home/home",
"text": "首页"
},
{
"iconPath": "static/tabbar/yuy1.png",
"selectedIconPath": "static/tabbar/yuy2.png",
"pagePath": "pages/reservation/index",
"text": "预约"
},
{
"iconPath": "static/tabbar/dl1.png",
"selectedIconPath": "static/tabbar/dl2.png",
"pagePath": "pages/guide/index",
"text": "导览"
},
{
"iconPath": "static/tabbar/my1.png",
"selectedIconPath": "static/tabbar/my2.png",
"pagePath": "pages/mine/index",
"text": "我的"
},
],
"midButton": {-------------------------------------2
"width": "60px",
"height": "60px",
"iconWidth": "50px",
"iconPath": "/static/tabBar/code.png"
}
},
2.此时不支持点击
需要在app.vue配置,跳转到指定页面
<script>
export default {
onLaunch: function() {
uni.onTabBarMidButtonTap(() => {
uni.navigateTo({
url: '/pages/code/code',
});
})
},
};
</script>