调整 iam
This commit is contained in:
+13
-10
@@ -3,6 +3,8 @@ import store from './store';
|
||||
import { tabKeyOf } from '@/router/tab';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import {
|
||||
consumeReloadQuery,
|
||||
hasReloadQuery,
|
||||
isChunkLoadError,
|
||||
reloadForChunkError,
|
||||
setPendingRoutePath,
|
||||
@@ -17,19 +19,20 @@ const lockPage = '/lock'; //锁屏页
|
||||
router.onError(error => {
|
||||
if (!isChunkLoadError(error)) return;
|
||||
if (reloadForChunkError()) {
|
||||
ElMessage.warning('页面资源加载失败,正在重新加载…');
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', event => {
|
||||
if (!isChunkLoadError(event.reason)) return;
|
||||
if (reloadForChunkError()) {
|
||||
event.preventDefault();
|
||||
ElMessage.warning('页面资源加载失败,正在重新加载…');
|
||||
ElMessage.warning('页面资源已更新,正在重新加载…');
|
||||
}
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (hasReloadQuery(to.query)) {
|
||||
next({
|
||||
path: to.path,
|
||||
query: consumeReloadQuery(to.query),
|
||||
hash: to.hash,
|
||||
replace: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
setPendingRoutePath(to.fullPath);
|
||||
const meta = to.meta || {};
|
||||
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
|
||||
@@ -59,7 +62,7 @@ router.beforeEach((to, from, next) => {
|
||||
fullPath: tabKeyOf(to),
|
||||
params: to.params,
|
||||
query: to.query,
|
||||
meta: meta,
|
||||
meta: { ...meta, keepAlive: true },
|
||||
});
|
||||
}
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user