fix:修复动态路由下cacheAble不生效的问题

This commit is contained in:
贺聂双 2021-11-23 19:53:39 +08:00
parent 56635a948b
commit 5139216ee8

View File

@ -301,7 +301,8 @@ export default {
routes.forEach(item => { routes.forEach(item => {
const cacheAble = item.meta?.page?.cacheAble ?? pCache ?? true const cacheAble = item.meta?.page?.cacheAble ?? pCache ?? true
if (!cacheAble) { if (!cacheAble) {
this.excludeKeys.push(new RegExp(`${item.path}\\d+$`)) const path = item.path.replace(/:.+?\//g, '.+?/').replace(/:.+?$/g, '.+$')
this.excludeKeys.push(new RegExp(`${path}`))
} }
if (item.children) { if (item.children) {
this.loadCacheConfig(item.children, cacheAble) this.loadCacheConfig(item.children, cacheAble)