Repository navigation
x-transition can not running when add dom from array #2865
Answered
by
ekwoka
LittleTom
asked this question in
7. Bugs (archived)
|
When I used $store, add dom from array, can not trigger x-transition:enter and x-transition:end I must add setTimeout to make dom show or hide, to correct it. |
Answered by
ekwoka
Apr 30, 2022
Replies: 1 comment 1 reply
|
This is normal behavior. The standard way to handle an entrance animation for new elements is to add the following directives: <div x-data="{ show: false }" x-show="show" x-init="$nextTick(()=>show=true)" x-transition>If you have the show state on the looped element then you can skip that part and use that prop. I'm pretty sure this is an acceptable implementation, and that needing it encapsulated in the template duplication is just not necessary. This provides more control for determining how and if the element should even transition in. You could probably wrap those up into an |
1 reply
Answer selected by
LittleTom
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is normal behavior.
The standard way to handle an entrance animation for new elements is to add the following directives:
If you have the show state on the looped element then you can skip that part and use that prop.
I'm pretty sure this is an acceptable implementation, and that needing it encapsulated in the template duplication is just not necessary. This provides more control for determining how and if the element should even transition in.
You could probably wrap those up into an
Alpine.bindfor reuse