![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
vue-router
clear_time
山不向我走来,我就向山走去。
展开
-
ue实现登录拦截功能
vue实现登录拦截功能// 登录拦截router.beforeEach((to,from,next)=>{ let token = localStorage.getItem('token') //登录成功,生成一个token(标识登录状态) if(token){ next() }else if(to.path !='/login'){ //查看访问的路由是否是login页面 next({name:'Login'}) }else{ next() }})原创 2020-08-08 17:46:32 · 187 阅读 · 0 评论 -
vue实现未登录无法访问某页面
vue实现未登录无法访问某页面//路由{ path: "index", name: "Index", component: () => import("@/views/home/index"), meta: { title: "首页" } },{ path: "about", name: "about", component: () => import("@/views/about/index"), m原创 2020-08-08 17:38:58 · 1931 阅读 · 0 评论