如图页面所示,如何对keep-alive缓存的页面,进行取消缓存,是否可以动态的设置include,或者其他类似实现的方法。
...
//template
<keep-alive :include="data.tabs.map(itm => itm.name).join(',')">
<router-view />
</keep-alive>
//script
const data = reactive({
tabs:[
{name:'home',label:'主页'},
{name:'offlineOrder',label:'线下订单'},
{name:'shop',label:'店铺绑定'},
],
closeClick(name) {
//我想在某个tab页面在点击关闭时,对keep-alive取消缓存,如何实现???
remove(this.tabs, {name:name})
}
})
...
找到解决方法了