Browse Source

feat:切换路由时确保相应抽屉关闭;

fuyang
YOU 9 months ago
parent
commit
17caa2d3a5
  1. 10
      src/router/index.ts

10
src/router/index.ts

@ -56,6 +56,13 @@ router.beforeEach((to, from, next) => {
const token = getToken(); const token = getToken();
const isPop = to.query.pop === 'true'; //新窗口打开内页 const isPop = to.query.pop === 'true'; //新窗口打开内页
NProgress.start(); NProgress.start();
const overLay: IObject | null = document.querySelector('.el-overlay .modify-form');
if (overLay && overLay.parentNode) {
overLay.parentNode.remove();
}
if (to.path !== '/login') { if (to.path !== '/login') {
if (store.state.routes.length) { if (store.state.routes.length) {
if (to.name === 'error') { if (to.name === 'error') {
@ -176,7 +183,7 @@ router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) { if (to.meta.requiresAuth) {
next('/login'); next('/login');
} else { } else {
next();
next();
} }
} }
} else { } else {
@ -191,7 +198,6 @@ router.beforeEach((to, from, next) => {
} else { } else {
next(); next();
} }
} }
}); });

Loading…
Cancel
Save