[Vuejs]-Router view on Vue 3 doesn't catch event from child

6👍

I just found this warning :

[Vue Router warn]: <router-view> can no longer be used directly inside <transition> or <keep-alive>.
Use slot props instead:

<router-view v-slot="{ Component }">
  <transition>
    <component :is="Component" />
  </transition>
</router-view>

So the answer is to make this:

  <router-view v-slot="{ Component }">
      <component :is="Component" @event-test="$emit('new-test-event')"/>
  </router-view>

Leave a comment