Commit 3c9af8a3 by liuchenxi

Merge branch 'feature/3月会员标签'

parents f7f370bd 1bbad60b
import Router from 'vue-router';
import _import from './_import.js';
import delCache from '@/utils/router-utils.js';
// import delCache from '@/utils/router-utils.js';
const errorPage = r => {
import('view/errorPage/index.vue').then(module => {
r(module);
......@@ -203,12 +203,8 @@ const router = new Router({
scrollBehavior: () => ({ y: 0 })
})
router.beforeEach((to, from, next) => {
const { keepAlive, componentName, fromPath = [] } = to.meta || {};
fromPath.push('/');
// 当前路径的keepAlive为true而且from.path不在fromPath中时,将清除to.path的缓存
if (keepAlive && fromPath.every(el => el != from.path)) {
delCache(router.apps, componentName);
}
const { fromPath = [] } = from.meta || {};
from.meta.keepAlive = fromPath.includes(to.path);
next();
})
export default router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment