Vue中的keep-alive不能缓存二级以上路由的解决办法 阿勋_ 2022-05-25 261 阅读1分钟 keep-alive的include可以加上组件name来缓存路由,但是缓存不了二级以上的路由 在路由拦截器中写上这几行代码,就能完美解决了 if (to.matched && to.matched.length > 2) { to.matched.splice(1, to.matched.length-2) }