From b2f944ccb51b3aeee19a1801498f1e831f16a139 Mon Sep 17 00:00:00 2001 From: Gvonte <37975449+Gvonte@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:22:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(Noticebar):=20=E4=BF=AE=E5=A4=8DNoticebar?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=ADvertical=E5=9E=82=E7=9B=B4=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E5=85=AC=E5=91=8A=EF=BC=8C=E5=9C=A8=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E8=BF=87=E7=A8=8B=E4=B8=AD=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=81=AE=E6=8C=A1=E7=9A=84=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=20(#1051)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Noticebar): 修复Noticebar组件中vertical垂直滚动的公告,在滚动过程中会出现文字遮挡的缺陷 * test: update snapshots --------- Co-authored-by: anlyyao --- src/swiper/swiper-item.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/swiper/swiper-item.vue b/src/swiper/swiper-item.vue index 12c2a32b5..f8663bf1d 100644 --- a/src/swiper/swiper-item.vue +++ b/src/swiper/swiper-item.vue @@ -29,11 +29,7 @@ const direction = computed(() => (isVertical.value ? 'Y' : 'X')); const calcTranslateStyle = (index: number, activeIndex: number) => { const distance = root.value?.[isVertical.value ? 'offsetHeight' : 'offsetWidth'] ?? 0; const lastItemIndex = items.value.length - 1; - let step = Math.min(index + 1, Math.abs(activeIndex - index)); - - if (activeIndex === index) step = 0; - else if (index === activeIndex + 1 || (loop && activeIndex === lastItemIndex && index === 0)) step = 1; - else if (index === activeIndex - 1 || (loop && activeIndex === 0 && index === lastItemIndex)) step = -1; + const step = activeIndex === lastItemIndex && index === 0 ? 1 : index - activeIndex; rootStyle.value = `transform: translate${direction.value}(${step * distance}px)`; };