-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
What problem does this feature solve?
Currently, transitions trigger based on 4 criteria (v-if, v-show, dynamic components, root nodes). However, there are situations where you may want to use a transition beyond these 4 triggers.
For example, when a component is created there could be several elements where the desired effect is for them to transition in sequence. Maybe a div expands and copy fades in once the expand completes. This can be accomplished nicely with Vue's transitions hooks to control the sequence of transitions. However, since the initial transition relies on one of the 4 aforementioned methods, there is no way to accomplish this effect without the content on the page jumping due to the div suddenly entering the document flow via v-if or v-show.
Being able to trigger the transition programmatically would allow you to hide the div through other means that do not remove it from the document flow (e.g. visibility: hidden) and then trigger the transition at an arbitrary time after the component is created.
here is a basic example => https://jsfiddle.net/3v0j0u7m/7/
This would be especially useful after a page transition. For example, a page transitions, page component mounts, content within the page component transitions separately and in sequence.
What does the proposed API look like?
<transition name="fade" :run="true"> // setting run to true would trigger the transition
<p>Some el</p>
</transition>