我无法使用转场或转场组添加动画。我有代码:
<transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
<div key=1 v-if="$route.name !== null">
<router-view></router-view>
</div>
<div v-else key=2>
<p>First text</p>
<p>Second text</p>
</div>
</transition>
从transtition
到transition-group
的更改无济于事。过渡应围绕:
<div v-if="$route.name !== null">
<router-view></router-view>
</div>
和
<p>First tex</p>
<p>Second text</p>
答案 0 :(得分:1)
我找到了解决方案。我使用了transition
两次。我不知道是否应该这样做,但是现在可以了。
<transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
<div key="save" v-if="$route.name !== null">
<transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
<router-view></router-view>
</transition>
</div>
<div v-else key="edit">
<p>First tex</p>
<p>Second text</p>
</div>
</transition>