fix(components): refresh cached routes

This commit is contained in:
alue_mobile
2023-03-01 13:56:04 +08:00
parent 506ffb8adf
commit b0f98e4bfa
2 changed files with 27 additions and 2 deletions

View File

@ -146,6 +146,22 @@ export const useRouteStore = defineStore('route-store', {
} else {
await this.initStaticRoute();
}
},
/** 从缓存路由中去除某个路由 */
removeCacheRoute(name: AuthRoute.AllRouteKey) {
const index = this.cacheRoutes.indexOf(name);
if (index > -1) {
this.cacheRoutes.splice(index, 1);
}
},
/** 添加某个缓存路由 */
addCacheRoute(name: AuthRoute.AllRouteKey) {
const index = this.cacheRoutes.indexOf(name);
if (index === -1) {
this.cacheRoutes.push(name);
}
}
}
});