vue 路由meta 设置title 导航隐藏


router.js

    routes: [{
            path: '/',
            name: 'HelloWorld',
            component: HelloWorld,
            meta: {
                title: "HelloWorld",    要现实的title
                show: true               设置导航隐藏显示
            }

        }]

 

App.vue

<template>
	<div id="app">
		<router-view></router-view>
		<bottom v-show="this.$route.meta.show"></bottom>   this.$route.meta.show  显示或隐藏
</div> </template>

  

main.js

 

router.beforeEach((to, from, next) => {

    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})

监听路由 写入 title

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM