router.beforeEach((to, from, next) => {
if(to.path==='/login') return next()
const tokensk= window.sessionStorage.getItem('token')
if(!tokensk) return next('/login')
next();
})
export default router```
简单导航守卫
最新推荐文章于 2024-11-18 12:10:44 发布