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进行截取即可解决
相关推荐
only-qi15 小时前
Redis如何应对 Redis 大 Key 问题
数据库·redis·缓存
天生励志12318 小时前
Redis 安装部署
数据库·redis·缓存
武帝为此20 小时前
【Redis 数据库介绍】
数据库·redis·缓存
铁锚21 小时前
Redis中KEYS命令的潜在风险与遍历建议
数据库·redis·缓存
程序员果子1 天前
零拷贝:程序性能加速的终极奥秘
linux·运维·nginx·macos·缓存·centos
可爱の小公举1 天前
Redis技术体系全面解析
数据库·redis·缓存
Mxsoft6191 天前
接触电阻监测误报,多物理场特征融合救场!
缓存
Geoking.1 天前
Redis 中 ziplist 与 quicklist 解析与对比
数据库·redis·缓存
第二只羽毛1 天前
C++高性能内存池
开发语言·c++·缓存·性能优化
卿雪1 天前
Redis 数据持久化:RDB和 AOF 有什么区别?
java·数据库·redis·python·mysql·缓存·golang