Home

Issue: 34

Routes transitions javascript hooks

[issue link]

Any way to add the javascript hooks to the <transition>?

<transition
  v-on:before-enter="beforeEnter"
  v-on:enter="enter"
  v-on:after-enter="afterEnter"
  v-on:enter-cancelled="enterCancelled"
  v-on:before-leave="beforeLeave"
  v-on:leave="leave"
  v-on:after-leave="afterLeave"
  v-on:leave-cancelled="leaveCancelled"
>
  <!-- ... -->
</transition>

Maybe we could simply add transition: { hooks: true } as a viable option in nuxt-config? And then add the same as above into <transition> (seems overkill to be able to name the hooks yourself).

Thing to watch out for though:

It’s also a good idea to explicitly add v-bind:css="false" for JavaScript-only transitions so that Vue can skip the CSS detection. This also prevents CSS rules from accidentally interfering with the transition.
This feature request is available on Nuxt.js community (#c27)