【发布时间】:2019-12-08 14:47:35
【问题描述】:
这是我的代码:我想在每次数据更新时在 HelloWorld 组件上创建一个转换。过渡本身工作正常
<transition name="fade">
<p v-if="awesome">Vue is awesome</p>
</transition>
这是我动态创建的“卡片”。
<v-row no-gutters>
<v-col cols="12" sm="4" md="4" v-for="(todo, index) in todos" v-bind:key="index">
<v-card class="pa-2" outlined tile>
<transition name="fade">
<HelloWorld
v-bind:todos="todos"
v-bind:index="index"
v-bind:class="(todos[index].done)?'green':'red'"
/>
</transition>
</v-card>
</v-col>
</v-row>
这里的过渡不起作用。
CSS 在这里:
<style scoped>
.top {
background: blue;
color: white;
display: flex;
justify-content: space-around;
border-bottom: 2.5px solid black;
}
.fade-enter {
opacity: 0;
}
.fade-enter-active {
transition: opacity 1s;
}
.fade-leave {
}
.fade-leave-active {
transition: 1s;
opacity: 0;
}
</style>
为什么以及如何让它发挥作用?
【问题讨论】:
标签: vue.js transition