Skip to content

使用router-view+keep-alive报错 TypeError: parentComponent.ctx.deactivate is not a function #9132

Answered by likui628
fshihu asked this question in Help/Questions
Discussion options

You must be logged in to vote

add key prop

<router-view v-slot="{ Component, route }">
    <keep-alive>
      <component
        :is="Component"
        v-if="route.meta.keepAlive"
        :key="route.fullPath"
      />
    </keep-alive>
    <component :is="Component" v-if="!route.meta.keepAlive" />
  </router-view>

https://stackblitz.com/edit/vitejs-vite-s64hc9?file=src%2FApp.vue

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fshihu
Comment options

Answer selected by fshihu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants