Reputation: 2783
I have an app with a simple child/grandchild 2-layer nesting and I'm trying to do transitions on both layers of nuxt-child(ren). Mysteriously, the transition works fine on the grandchild but for some reason doesnt work on the child even though its the same transition. I can inspect in the inspector and verify that its applying the classes correctly. What ends up happening is that instead of a smooth transition for 500ms, it just pauses for 500ms and renders the child page.
Here's the simple repo demonstrating the issue. Here's the code sandbox with a deployed app.
Here's how I'm doing transitions:
Template:
<transition name="jade" mode="out-in">
<nuxt-child></nuxt-child>
</transition>
Style:
.jade-enter-active {
transition: all .3s ease;
}
.jade-leave-active {
transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.jade-enter, .jade-leave-to
{
transform: translateX(10px);
opacity: 0;
}
Upvotes: 0
Views: 751
Reputation: 425
While I'm not entirely sure why this is happening, there are two ways you can solve this
transition
property in individual pages (Nuxt Docs)/src/index.vue
export default {
transition: {
name: 'jade',
mode: 'out-in'
}
}
pageTransition
in nuxt.config.js
, which will apply globally to all the transition components (Nuxt Docs)/nuxt.config.js
export default {
pageTransition: 'jade'
// or
pageTransition: {
name: 'jade',
mode: 'out-in'
}
}
Here's my Sandbox link using transition
property
Upvotes: 1