🌀(component): 优化carousel首次加载时不应存在动画效果,而是应立即显示默认的item

This commit is contained in:
0o张不歪o0
2022-07-04 13:13:23 +08:00
parent 6a3fde09ae
commit 780584e989
3 changed files with 5 additions and 3 deletions

View File

@@ -39,6 +39,7 @@
transition-duration: 0.3s;
-webkit-transition-duration: 0.3s;
overflow: hidden;
visibility: hidden;
}
.layui-carousel-updown > * {

View File

@@ -45,15 +45,15 @@ const getStyle = computed<any>(() => {
if (activeIndex === currentIndex) {
if (animation === "updown") {
return {
transform: "translateY(0)",
transform: "translateY(0)", visibility: 'inherit'
};
} else if (animation.includes("fade")) {
return {
opacity: 1,
opacity: 1,visibility: 'inherit'
};
} else {
return {
transform: "translateX(0)",
transform: "translateX(0)",visibility: 'inherit'
};
}
}