vue3在使用keep-alive出现切换页面报错

vue-router.esm-bundler.js?f6c4:3295 
        
       TypeError: parentComponent.ctx.deactivate is not a function
    at unmount (runtime-core.esm-bundler.js?9e79:4686)
    at patch (runtime-core.esm-bundler.js?9e79:3664)
    at Object.sharedContext.activate (runtime-core.esm-bundler.js?9e79:1708)
    at processComponent (runtime-core.esm-bundler.js?9e79:4097)
    at patch (runtime-core.esm-bundler.js?9e79:3695)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?9e79:4310)
    at ReactiveEffect.run (reactivity.esm-bundler.js?0a2b:160)
    at updateComponent (runtime-core.esm-bundler.js?9e79:4171)
    at processComponent (runtime-core.esm-bundler.js?9e79:4104)
    at patch (runtime-core.esm-bundler.js?9e79:3695)

在这里插入图片描述

在网上搜到的bug解释

大佬链接文档

解决办法

在keep-alive、component上设置key进行排序

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐