`<router-view>` exposes a `v-slot` API mainly to wrap your route components with `<transition>` and `<keep-alive>` components.
```html
-<Suspense>
- <template #default>
- <router-view v-slot="{ Component, route }">
- <transition :name="route.meta.transition || 'fade'" mode="out-in">
- <keep-alive>
+<router-view v-slot="{ Component, route }">
+ <transition :name="route.meta.transition || 'fade'" mode="out-in">
+ <keep-alive>
+ <suspense>
+ <template #default>
<component
:is="Component"
:key="route.meta.usePathKey ? route.path : undefined"
/>
- </keep-alive>
- </transition>
- </router-view>
- </template>
- <template #fallback> Loading... </template>
-</Suspense>
+ </template>
+ <template #fallback> Loading... </template>
+ </suspense>
+ </keep-alive>
+ </transition>
+</router-view>
```
- `Component`: VNodes to be passed to a `<component>`'s `is` prop.