菜单栏的隐藏和显示

在app.vue中

<div id="nav"  v-show="$route.meta.istrun">

然后再router文件夹中的index.js中

// 4. 配置路由与组件映射关系

let routes = [//创建Vue Router实例,并完成路由映射配置

{

    path: "/",

    redirect: '/home'

},

    {

        path: '/home',

        component: Home,

        meta:{

            istrun:true

          },进行判断,如果需要就是true

    },

   

    {

        path: '/about',

        component: About,

        meta:{

            istrun:true

          },

    },

   

    {

        path: '/dingdan',

        component: Dingdan,如果不需要就不进行填写,默认就是没有的

       

    },

猜你喜欢

转载自blog.csdn.net/weixin_43972428/article/details/127013150