Trigger all <transition>s without a corresponding v-if/v-show on component mounting
See original GitHub issueWhat problem does this feature solve?
A <transition>
without a corresponding v-if
/v-show
not at the component’s template’s root will never be triggered. This may be by design, but it is confusing because a <transition>
at the component’s template’s root does get triggered when the component is mounted.
What does the proposed API look like?
When the following modal’s template is mounted/destroyed, the dynamic fade-in-*
classes are applied correctly, but the inner “slide-up” effect is never triggered. I propose that all <transition>
s (including the inner ones) that do not have an associated v-for
/v-if
/etc be triggered on component mounting (& before destroy).
<template>
<transition name="fade-in">
<div class="modal-backdrop">
<transition name="slide-up">
<div v-show="show" class="modal" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<slot></slot>
</div>
</div>
</div>
</transition>
</div>
</transition>
</template>
Currently, I’m using the following workaround, with the parent calling the close
method via $refs
and listening for 'close'
before destroying the modal.
<script>
export default {
data() { return { show: false } },
mounted() {
this.show = true
},
methods: {
close() {
this.show = false
this.$nextTick(() => this.$emit('close'))
}
}
}
</script>
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React Transition Group - How to trigger animation for a ...
As far as I know, React Transition Groups works only in transition ... library to animate component when mounting like: React-animations.
Read more >Animation transitions and triggers - Angular
This guide goes into depth on special transition states such as the * wildcard and void . It shows how these special states...
Read more >Transition | Vue.js
Vue offers two built-in components that can help work with transitions and animations in response to changing state: <Transition> for applying animations ......
Read more >Trigger effect only on mount - Learn React Hooks [Book]
Passing an empty array means that our effect function will only trigger once when the component mounts, and it will not trigger when...
Read more >Advanced animation patterns with Framer Motion
A deep dive into Framer Motion's propagation, exit transitions and ... being set by the parent component, the animation does not trigger and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does adding
appear
to the<transition>
fix the problem?I will take this to StackOverflow, but here is a sandbox showing what I mean. The transition classes are applied to the inner
transition
properly on entering, but not on leaving. https://codesandbox.io/s/961npvk3o