`onEnter` of transition component is fired when its child is set to `v-show="false"`
Version
3.2.20
Reproduction link
Steps to reproduce
See the link
What is expected?
onEnter
is not fired since v-show=false
What is actually happening?
onEnter
is fired
Please refer to: https://v3.vuejs.org/guide/conditional.html#v-if-vs-v-show
Maybe it is not a bug?
persisted is designed for this condition.
You should set persisted
to true
.
persisted
I can't understand what it behaves by reading the docs. I just want it have the same behavior on hooks like v-if
.
It is Intentional? Just in my option,v-show means element actually render.It seems reasonable if it trigger the enter hooks.
It is Intentional? Just in my option,v-show means element actually render.It seems reasonable if it trigger the enter hooks.
I don't think so. Enter is transition's enter, not the child element's enter.
@07akioni , I think you should delete the appear
attribute from the transition because according to docs :
If you also want to apply a transition on the initial render of a node, you can add the appear
The element has rendered because v-show will just add an display:none
to element and when you add the appear
, the onEnter method will be fired.
So you can do 2 things to solve this problem :
- delete
appear
attribute - change
v-if
tov-show
(preferred way)
@07akioni , I think you should delete the
appear
attribute from the transition because according to docs :If you also want to apply a transition on the initial render of a node, you can add the appear
The element has rendered because v-show will just add an
display:none
to element and when you add theappear
, the onEnter method will be fired. So you can do 2 things to solve this problem :
- delete
appear
attribute- change
v-if
tov-show
(preferred way)
I want the animation play on its first mount.
I want the animation play on its first mount.
your description is really incomplete . if you want that animation play on its first mount , so what is the bug?
I want the animation play on its first mount.
your description is really incomplete . if you want that animation play on its first mount , so what is the bug?
When default v-show
is set to true
, everything works fine.
The main problem is when the default v-show
is set to false
, the animation done (onEnter) hook is still called.
This is inconsistent between v-show
and v-if
. I expect all the hooks should be fired in the same manner. There's no document clearly regulates the behavior.