Vue: Allow nested transition to trigger upon removal

Created on 16 Jan 2019  路  5Comments  路  Source: vuejs/vue

Version

2.5.22

Reproduction link

https://jsfiddle.net/wx91uLft/
other: https://jsfiddle.net/ae82rfnv/

Steps to reproduce

  • Show/hide elements with the "Toggle" button.
  • Show/hide elements with the "Toggle Ticked" button. Shows a workaround.

What is expected?

All transitions should be triggered on leave, even for nested child elements.

What is actually happening?

Transition classes don't get applied to nested child elements, when conditions for leaving transitions occur on the same tick.

Workaround: Delaying the parent transitions by one tick fixes the problem.


This has been reported, but got closed due to the sample code did not use appear on the <transition> elements. (See issues #7643 and #9243)

My example is more detailed and also provides a workaround.

feature request transition

Most helpful comment

it could be via a new prop on transition I think 馃 . I haven't checked the feasibility though although it should be possible

All 5 comments

This is working as expected because when both conditions are set to false on the same tick, only the parent is removed by the v-if, nothing inside is evaluated. That's why the inner transition doesn't trigger, it wasn't removed directly

Wow, that's disappointing. 馃槩
So if we want to have working nested transitions in Vue, this should be considered a feature request?

it could be via a new prop on transition I think 馃 . I haven't checked the feasibility though although it should be possible

Nice! 馃槉馃憤

For future reader, @posva is right, we can achieve that via props.

I made a quick example here for the matter.
I used @before-leave="" to trigger the parent transition (change of state), and @before-enter="" on the parent, to trigger the animation on the child element.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RashadSaleh picture RashadSaleh  路  51Comments

cherry-geqi picture cherry-geqi  路  35Comments

karevn picture karevn  路  36Comments

smolinari picture smolinari  路  116Comments

yyx990803 picture yyx990803  路  36Comments