扫码关注官方订阅号
我现在是想通过router的全局钩子来实现底部导航在一级页面显示,在子页面不显示,所以在app.vue中加入了navShow来控制,可是我router.app得不到这个值。请问有什么方法实现吗。希望前辈们指导下。
业精于勤,荒于嬉;行成于思,毁于随。
在路由的元信息中设置不是更好吗?router.js
const router = new VueRouter({ mode: 'history', routes: [ { path: '/first', component: firstView, meta: { navShow: true, cname: '一级页面' }, name: 'first' }, { path: '/sub', component: subView, meta: { navShow: false, cname: '子页面' }, name: 'sub' }, ], });
app.vue
<Bar v-show="$route.meta.navShow">
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
在路由的元信息中设置不是更好吗?
router.js
app.vue