怎么清除keeplive 缓存

img


场景是 一个详情页 通过不同参数 用fullPath来绑定key来实现 一个详情页根据不同参数缓存了很多套
现在我想删除 指定key的缓存,有什么方法吗
网上都是说用 include ,但是include 是需要组件 name属性,一个组件只有一个name ,跟我这个场景不符合,网上好像页找不到什么解决方法

应该能满足你的需求
https://blog.csdn.net/weixin_47074432/article/details/119517629

使用meta的方式,就你上面的这种
不过这种缺点就是不能动态删除缓存, 还有就是我们想在路由切换的时候做动画不好做,不能直接用 transition做过渡动画

<keep-alive>
    <router-view  :key="$route.path" v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view :key="$route.path" v-if="!$route.meta.keepAlive"></router-view>

关于使用 include 方式,你可以看看我这篇文章,希望能搬到你
https://blog.csdn.net/z1832729975/article/details/122133571