父件 导航栏添加 v-show="showNav" 设置为false:
<template>
<div>
<router-view />
<van-tabbar route
v-model="active"
v-show="showNav">
<van-tabbar-item replace
to="/home"
icon="home-o">
首页
</van-tabbar-item>
<van-tabbar-item replace
to="/user"
icon="user-o">
用户
</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script>
export default {
name: 'Mainpage',
data () {
return {
active: 0,
showNav: false
}
},
methods: {
},
}
</script>
子件 home.vue中 v-show="showNav" 设置为true
created () {
this.$parent.showNav = true
}
参考文章:https://blog.csdn.net/maidu_xbd/article/details/93711508