keep-alive缓存,三级路由不生效

此文章讲诉在vue中使用keep-alive缓存,三级路由缓存失败处理方案。

一二级路由缓存无任何问题,三级以上就会失败,因此我们在路由守卫中对matched做出如下优化

javascript 复制代码
Router.beforeEach((to, from, next)=>{
	if(to.matched && to.matched.length>2){
		to.matched.splice(1,to.matched.length -2)
	}
	next()
})
在路由拦截中对matched进行截取即可解决
相关推荐
BullSmall15 小时前
Another Redis Desktop Manager(ARDM)下载指南
数据库·redis·缓存
nvd1117 小时前
ArgoCD 双层轮询深入拆解:从 redis-app.yaml 注册到缓存重建的完整链路
redis·缓存·argocd
xiaoxiangsiyan17 小时前
LNMP + Redis Sentinel 高可用架构部署手册(续)
运维·网络·数据库·redis·缓存·架构·sentinel
難釋懷21 小时前
Nginx外置缓存-redis2-nginx-module
nginx·缓存·junit
LearnYard21 小时前
Android存储空间清理策略对比:缓存识别与多种清理方案的技术分析
缓存·智能手机
弹简特1 天前
【Vue3速成】06-vue3官方库路由机制之Pinia状态管理
vue·pinia
时空自由民.1 天前
STM32的缓存Cache
stm32·嵌入式硬件·缓存
Sam_Deep_Thinking1 天前
如何维持缓存的一致性?
java·缓存·面试·程序员·系统架构
java1234_小锋1 天前
Vue3专题 - 响应式基础
vue·vue3·响应式
ai_coder_ai2 天前
分布式缓存架构设计与实践
分布式·缓存