keep-alive 下的组件加了上 key 没有触发 onBeforeUnmount
Vue version
3.2.27
Link to minimal reproduction
Steps to reproduce
click "refresh Comp1" click "set keep Comp2" click "show Comp2"
What is expected?
Comp1 组件应该会触发两次 onBeforeUnmount
What is actually happening?
只触发了最后一个实例的 onBeforeUnmount
System Info
No response
Any additional comments?
No response
你默认设置了comp1缓存,不会触发unmount, 是单独的钩子https://vuejs.org/guide/built-ins/keep-alive.html#lifecycle-of-cached-instance
你默认设置了comp1缓存,不会触发unmount, 是单独的钩子https://vuejs.org/guide/built-ins/keep-alive.html#lifecycle-of-cached-instance
你看,第二步,已经把 include 修改成 comp2 了。