Vue3 transition-group, enter active animation is not working while leave is working(Vue3过渡组,进入活动动画不工作,而休假正在工作)
本文介绍了Vue3过渡组,进入活动动画不工作,而休假正在工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试以动画形式在v-for循环中添加和删除元素。 我在这里搜索了一些类似的问题,答案主要是关于 Vue3中的类名从vue2更改。
我确信我的案例与类名无关。 我的代码如下所示。
组件名称:VueOnly
<transition-group tag='div' class='VueOnly' name='fade'>
<div class='graphs' v-for="boro in lotteriesByBorough" :key="boro['value']">
<div>{{boro[0]}}</div>
<div class="bargraph" :style="{width: xScale(boro[1]) + 'px'}"></div>
</div>
</transition-group>
<div style='display:none'>{{console}}</div>
</template>
*css
.fade-enter-active{
animation:fade-in 1s
}
.fade-leave-active{
animation:fade-in 1s reverse
}
@keyframes fade-in {
from{
opacity:0 ;
width:0 ;
background-color:blue ;
}
to{
opacity:1;
width:100%;
}
}
我坚信我遵循的语法是
为什么这不起作用?
只有在触发‘Leave’事件时才起作用。 在运行"Leave"事件时添加临时类,而在运行"Enter"事件时不添加任何类。
所以我认为总体上在进入过程中存在问题。
是否与加法逻辑有关?
我的加法逻辑如下。 App.vue
<div class="filters">
<el-checkbox-group v-model="filters">
<el-checkbox label="1"></el-checkbox>
<el-checkbox label="2"></el-checkbox>
<el-checkbox label="3"></el-checkbox>
<el-checkbox label="4"></el-checkbox>
</el-checkbox-group>
</div>
<div class="section" :style="{width:`${width}px`,height:`${height}px`}">
<vue-only
:lotteries="filteredLotteries"
:lottery-stats="lotteryStats"
:width="width"
>
</vue-only>
</div>
The entire code can be seen in the following link.
https://github.com/jotnajoa/studioquestion/tree/main/d3vue
推荐答案
将appear
property设置为<transition-group>
:
<transition-group tag="div" class="VueOnly" name="fade" appear>
demo
这篇关于Vue3过渡组,进入活动动画不工作,而休假正在工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:Vue3过渡组,进入活动动画不工作,而休假正在工作


猜你喜欢
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Fetch API 如何获取响应体? 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07