gpt4 book ai didi

css - React Transition Group : What is the difference between the appear, enter, exit 事件和enter, active done className后缀?

转载 作者:行者123 更新时间:2023-11-28 08:50:14 24 4
gpt4 key购买 nike

为什么会有这么多变化?我记录了我的开发人员工具的元素选项卡,它似乎只有“-enter-done”和“-exit”类被应用于动画元素。

最佳答案

文档 explain it很容易:

CSSTransition applies a pair of class names during the appear, enter,and exit stages of the transition. The first class is applied and thena second "active" class in order to activate the css animation. Afterthe animation, matching done class names are applied to persist theanimation state.

所以出现、进入和退出是触发这些动画的不同情况。

出现 - 当您希望在组件首次挂载时进行转换(例如刷新页面时)。

Enter - 挂载新元素时的过渡。

退出 - 当元素卸载时。

后缀的作用是允许你在动画的每一步设置不同的CSS属性。

.my-animation-enter {
opacity: 0;
transition: opacity 1s ease;
}

.my-animation-enter-active {
opacity: 1;
}

.my-animation-enter-done {
cursor: pointer;
}

关于css - React Transition Group : What is the difference between the appear, enter, exit 事件和enter, active done className后缀?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50303048/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com