本文主要介绍了VantUI封装自定义Tabbar路由跳转的实现,分享给大家,具体如下:
在src目录下新建个components文件夹来放自己定义的tabbar组件
template>
<div
v-if="
$route.name == 'index' ||
$route.name == 'learn' ||
$route.name == 'person'
"
>
<van-tabbar v-model="active" inactive-color="#666666" active-color="#000000" fixed placeholder>
<van-tabbar-item replace v-for="(item, index) in tabbarList" :key="index" :to="item.path">
<span>{
{ item.title }}</span>
<img slot="icon" slot-scope="props" :src="props.active ? item.active : item.normal" />
</van-tabbar-item>