2.1.3
http://codepen.io/weotch/pen/GNyWaV
Go to that codepen and click both links for "show" and "if" to "yes". Toggle just "show" off, note the transition occurs. Toggle "show" back on and then toggle "if" off, note that there is no transition out.
I expected to still see the box transition out. Or, in other words, anenter transition should trigger only if both v-show and v-if == true. And a leave transition should trigger only if either v-show or v-if != true.
If v-if == true and v-show changes from true to false, the leave transition occurs as expected. If v-show== true and v-if changes from true to false, the element is immediately removed, no transition occurs.
My use case for this is using both v-if and v-show around media (img, video). The v-if triggers a load to start and then, once they are loaded, the v-show triggers the element to be revealed.
v-if and v-show are not supposed to be used together for transition purposes, because they entail conflicting start/ending states. Regarding your use case: you can use the v-if on the outer <transition> component instead.
Appreciate the feedback and thanks for that suggestion.
Can they use together now !? In Vue 2.x version.
@sky790312 the above was for Vue 2.x (2.1.3)
Got it. Thanks!
Most helpful comment
v-ifandv-showare not supposed to be used together for transition purposes, because they entail conflicting start/ending states. Regarding your use case: you can use thev-ifon the outer<transition>component instead.