Skip to content

Instantly share code, notes, and snippets.

@whaaaley
Last active February 9, 2024 22:26
Show Gist options
  • Save whaaaley/7a76a83944940956bdfbdaebb48812c9 to your computer and use it in GitHub Desktop.
Save whaaaley/7a76a83944940956bdfbdaebb48812c9 to your computer and use it in GitHub Desktop.
How to setup Vue Router transitions with JSX inside of Vue 3
import { resolveDynamicComponent, Transition } from 'vue'
import { RouterView } from 'vue-router'
export default {
setup () {
return () => {
const slots = view => (
<Transition name='fade'>
{resolveDynamicComponent(view.Component)}
</Transition>
)
return <RouterView v-slots={ slots }/>
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment