zoukankan      html  css  js  c++  java
  • 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

      

  • 相关阅读:
    Jquery入门
    微服务
    数组
    流程控制
    GO的整型
    Go的巧记
    变量和常量
    Golang
    股票入市指南
    linux 命令行操作
  • 原文地址:https://www.cnblogs.com/nns4/p/8589539.html
Copyright © 2011-2022 走看看