VueJS - 即使“appear”属性为 false,转换组也会对组件列表的初始渲染进行动画处理

GCA*_*GCA 5 javascript vue.js vue-component vuejs2

我面临着过渡组的奇怪行为。

我有这个CSS转换:

.slide-fade-pop-enter-active {
  transition: all .4s ease-out;
}

.slide-fade-pop-enter {
  background-color: $color-yellow-light;
  transform: translateY(3px);
  opacity: 0;
}
Run Code Online (Sandbox Code Playgroud)

我有一个Cart组件和CartItem 子组件。在购物车内,我有CartItem,如下所示:

<transition-group name="slide-fade-pop" tag="ul" class="cart__content">
    <cart-item v-for="(item, index) in items"
               :key="index">
    </cart-item>
</transition-group>
Run Code Online (Sandbox Code Playgroud)

这会触发初始渲染动画,尽管如您所见,我没有使用“appear”属性/道具,如文档所述,它会触发初始渲染动画。

当我将CartItem组件切换为简单的li(实际上是 CartItem 时,如下所示:

<transition-group name="slide-fade-pop" tag="ul" class="cart__content">
    <li v-for="(item, index) in items"
               :key="index">
    </li>
</transition-group>
Run Code Online (Sandbox Code Playgroud)

转换按预期进行。没有初始渲染,列表中的后续添加是动画的。

这是错误还是功能,而我的子组件缺少某些内容?