介绍:
beforeEnter独享路由守卫
单独给某个路由进行校验
操作:
{ name:'xiaoxi', path: 'aboutone', component: aboutone, // 需要校验就写 meta:{isAuth:true,title:'列表一'}, children:[ { path: 'aboutoneson', component: aboutoneson, meta:{isAuth:true,title:'详情'}, beforeEnter:(to,from,next)=>{ if (to.meta.isAuth){ // 如果本地存储的Nuber值为yang就跳转,反之弹出权限不够 if (localStorage.getItem('Number') === 'tian') { next() } else{ alert('权限不够') } } else{ next() } } } ] },
标签:isAuth,独享,next,meta,beforeEnter,路由 From: https://www.cnblogs.com/0722tian/p/17158639.html