1、遇到的问题:
后台管理系统打开新页面,然后关闭,再重新打开,没有重新发请求
![](https://i-blog.csdnimg.cn/blog_migrate/ee3c8fd32b11c1b935f250ca626914ac.png)
![](https://i-blog.csdnimg.cn/blog_migrate/f65452b3378dc045e8cb27259dd30f19.png)
就是说getKeepAliveNames理应是计算属性,出现上面的问题,就是因为我们在关闭tab的时候,getKeepAliveNames依赖的值没有改变,所以出现的上面的问题。
2、解决
解决就是使getKeepAliveNames式计算属性即可(是动态的,可以根据增减tab变化的)
const getKeepAliveNames = computed(() => {
// 具体依赖值,根据自己的项目来
return keepAliveNames.value
})
更具体的可参考:另外大佬的博客园