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