Transition properties
Set the default properties of the page and layout transitions.
The pageTransition Property
Nuxt v2.7.0 introduces key "pageTransition" in favor of the "transition" key to consolidate the naming with layout transition keys.
-
Type:
StringorObject
Used to set the default properties of the page transitions.
Default:
{
name: 'page',
mode: 'out-in'
}
nuxt.config.js
export default {
pageTransition: 'page'
// or
pageTransition: {
name: 'page',
mode: 'out-in',
beforeEnter (el) {
console.log('Before enter...');
}
}
}
The transition key in nuxt.config.js is used to set the default properties for the page transitions. To learn more about the available keys when the transition key is an object, see the pages transition property .
The layoutTransition Property
-
Type:
StringorObject
Used to set the default properties of the layout transitions. The value provided in the
nameoption is configured to work with the name provided inlayoutfrom yourlayoutsfolder.
Default:
{
name: 'layout',
mode: 'out-in'
}
nuxt.config.js
export default {
layoutTransition: 'layout'
// or
layoutTransition: {
name: 'layout',
mode: 'out-in'
}
}
assets/main.css
.layout-enter-active,
.layout-leave-active {
transition: opacity 0.5s;
}
.layout-enter,
.layout-leave-active {
opacity: 0;
}
Edit this page on GitHub
Updated at Tue, Apr 5, 2022
Nazaré da Piedade
Mosaab Emam
Sylvain Marroufin
Iljs Путлер Капут
Daniel Roe
Heitor Ramon Ribeiro
Nero
Sébastien Chopin
Clément Ollivier
Yoon Han
Ikko Ashimine
FamCodings
Ayouli
F. Hinkelmann
felipesuri
Christophe Carvalho Vilas-Boas
Leoš Literák
Trizotti
Marcello Bachechi
Rodolphe
Thomas Underwood
Shek Evgeniy
Lukasz Formela
Hugo Torzuoli
Kareem Dabbeet
tramplay
verebelyicsaba
Adam
Nate Butler
Sandra Rodgers
Arpit Patidar
Matthew Kuehn
Steven DUBOIS
Travis Lindsey
syagawa
Maxime
かる
Al Power
Florent Delerue
quanghm
José Manuel Casani Guerra
Unai Mengual
kazuya kawaguchi
Michael Lynch
Tomachi
pooya parsa
Meir Roth