question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global transition with JS hooks

See original GitHub issue

Hello 👋,

I am trying to port my “vue syntax transition” to a more “nuxt friendly” solution. For now I have :

<script setup lang="ts">
const onBeforeLeave = (el) => {}
const onLeaver = (el, done) => {}
const onEnter = (el, done) => {}
const onAfterEnter = (el) => {}
</script>

<template>
        <router-view v-slot="{ Component }">
          <Transition
            mode="out-in"
            :css="false"
            @before-leave="onBeforeLeave"
            @leave="onLeave"
            @enter="onEnter"
            @after-enter="onAfterEnter"
          >
            <component :is="Component" />
          </Transition>
        </router-view>
</template>

that is working quite well. however, the following config coming from the doc doesn’t seems to work in app.vue:

<script setup lang="ts">
definePageMeta({
  pageTransition: {
    name: 'custom-flip',
    mode: 'out-in',
    onBeforeEnter: (el) => {
      console.log('Before enter...')
    },
    onEnter: (el, done) => {},
    onAfterEnter: (el) => {}
  }
})
</script>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
danielroecommented, Oct 20, 2022

it’s an upstream bug in vue. workaround at the moment is to await a nextTick().

1reaction
danielroecommented, Oct 20, 2022

I don’t think it’s my syntax. I think it’s the same issue as https://github.com/nuxt/framework/issues/3587.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js 3 Javascript Animation Transition Hooks Tutorial
Vue allows us to execute Javascript code at different stages of our animations, allowing us to build more complex animation behavior. These hooks...
Read more >
Applying CSS Transitions with React Hooks | by Kaylie Kwon
We'll gradually build up to the full functionality, so let's begin with a simple hook useTransitionState that will change the state from ...
Read more >
Transition Hooks - UI-Router
Global transition hooks are registered using the hook registration methods on the TransitionService (referred to as $transitions in the ...
Read more >
Hooks - barba.js
Hooks are triggered by Transitions and Views , but are not “shared” between them: they run separately, either synchronously or asynchronously using the...
Read more >
Nuxt JavaScript hooks transition - a bug? - Stack Overflow
According to the information you've provided there are a few things I would like you to notice. If you refer to the nuxt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found