自定义tabbar以组件形式引入页面,自定义tabbar组件:
<template>
<view>
<u-tabbar v-model="current" :list="tabarList" :mid-button="false" active-color="#0081ff" inactive-color="#606266"></u-tabbar>
</view>
</template>
<script>
export default {
name:"bottomBar",
data() {
return {
tabarList: [{
iconPath: "home",
selectedIconPath: "home-fill",
text: '首页',
customIcon: false,
pagePath: '/pages/index/index',
},
{
iconPath: "account",
selectedIconPath: "account-fill",
text: '我的',
customIcon: false,
pagePath: '/pages/userInfo/index',
},
],
current: 0,
};
}
}
</script>
<style>
</style>
首页引入后发生错位,仅首页发生错位,其他页面正常,删除pages.json的tabbar配置项正常显示,配置tabbar项首页自定义tabbar会被顶起,且pages.json中tabbar设置文字会被显示出来。