1,在路由内部直接拦截
{
path:'/active',
component:Active,
meta:{
iskey:true
},
//路由独享(局部)拦截
beforeEnter:(to,from,naxt)=>{
if(localStorage.getItem('token')){
naxt()
}else{
next('/login')
}
}
},
2.直接在页面center组件中拦截
center