vue3 router-view 使用keep-alive报错parentcomponent.ctx.deactivate is not a function

问题

如下图,在component组件上添加v-if判断,会报错:
parentcomponent.ctx.deactivate is not a function
vue3 router-view 使用keep-alive报错parentcomponent.ctx.deactivate is not a function_第1张图片

解决方法

去除v-if,将key直接添加上。由于有的公用页面,需要刷新,不希望缓存,所以需要添加key。其他需要缓存的页面,就不用添加key
vue3 router-view 使用keep-alive报错parentcomponent.ctx.deactivate is not a function_第2张图片

你可能感兴趣的:(vue,vue3)