1
0
热心网友
router.js
// 全局路由导航守卫 router.beforeEach((to, from, next) => { const tokenStr = localStorage.getItem('token') if (to.path === '/main' && !tokenStr) { // 证明用户要访问后台主页 next('/login') } else { // 访问的不是后台主页 next() } })
使用道具 舉報
本版積分規則 發表回覆 回帖並轉播 回帖後跳轉到最後一頁
相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com
Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.