API: transition Properties

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: String or Object

Used to set the default properties of the page transitions.

Default:

  1. {
  2. name: 'page',
  3. mode: 'out-in'
  4. }

Example (nuxt.config.js):

  1. export default {
  2. pageTransition: 'page'
  3. // or
  4. pageTransition: {
  5. name: 'page',
  6. mode: 'out-in',
  7. beforeEnter (el) {
  8. console.log('Before enter...');
  9. }
  10. }
  11. }

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: String or Object

Used to set the default properties of the layout transitions. Configurations are same as layout

Default:

  1. {
  2. name: 'layout',
  3. mode: 'out-in'
  4. }

Example (nuxt.config.js):

  1. export default {
  2. layoutTransition: 'layout'
  3. // or
  4. layoutTransition: {
  5. name: 'layout',
  6. mode: 'out-in'
  7. }
  8. }

Example global css:

  1. .layout-enter-active, .layout-leave-active {
  2. transition: opacity .5s
  3. }
  4. .layout-enter, .layout-leave-active {
  5. opacity: 0
  6. }