NuxtN
Nuxt2y ago
Werdox

Layout transition with javascript hook not working

I wanted to animate between layouts using anime.js. But it seems that the layout transition javascript hook doesn't even care about when the done() function is called and just immediately changes the layout.

here is my code:

definePageMeta({
   layout: "main",
   layoutTransition: {
      mode: "in-out",
      onEnter(el, done) {
         new Promise((resolve) => {
            setTimeout(() => {
               resolve(true);
            }, 5000);
         }).then(() => done());
      },
   },
});

here I'm just creating a promise that when done, with call the done function. i tried to await it; tried using just setTimeout; nothing worked!
Was this page helpful?