CanadaMes-ui/src/router/index.js
@@ -49,6 +49,11 @@ }, { path: '/device/talk', component: () => import('../views/device/talkvue'), }, { path: '/device/alarm', component: () => import('../views/device/alarm') }, @@ -96,6 +101,18 @@ // 获取token const hasToken = getToken(); const isExist = Vue.prototype.$tagList.some(tag => tag.path === to.fullPath); if (!isExist) { Vue.prototype.$tagList.push({ path: to.fullPath, data: null }); } // 没有token则跳转到登录页面 if (!hasToken) return next('/login');