Skip to content
Advertisement

dynamic transition name for ssr-nuxt page transition

I am trying to use a dynamic transition name for nuxt page transition like this belows

JavaScript

this code will be mixined in all page components.

But I got two bugs here:

  1. Cannot read property 'transitionName' of undefined Cannot read property 'transitionName' of undefined
  1. the prevHeight attribute will not change when redirect to other pages I add a wather in it like this
    JavaScript
    nothing will print in the console

What else: I try to fix it by using a callback function instead of a object like this:

JavaScript

but it won’t work.

How can I achieve this? I read the doucment (Nuxt transitions) but nothing help.

Thanks a lot!

Advertisement

Answer

After reading the resource code of nuxt, the

JavaScript

can be simply considered as

JavaScript

so, everything is clear, modify the layouts/default.vue

JavaScript

just like a SPA project

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement