From 915091bff1d719402cfd26885213d9f6c4183dbb Mon Sep 17 00:00:00 2001 From: hdx Date: Fri, 1 Mar 2024 17:04:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(swiper-list):=20web=20=E5=B9=B3=E5=8F=B0=20?= =?UTF-8?q?chrome=20windows=E7=B3=BB=E7=BB=9F=20transform=20scaleX?= =?UTF-8?q?=E6=B8=B2=E6=9F=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/long-list/long-list.uvue | 8 ++++++++ pages/template/long-list2/long-list2.uvue | 8 ++++++++ pages/template/swiper-list/swiper-list.uvue | 10 +++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pages/template/long-list/long-list.uvue b/pages/template/long-list/long-list.uvue index b3933f32..192b0954 100644 --- a/pages/template/long-list/long-list.uvue +++ b/pages/template/long-list/long-list.uvue @@ -204,8 +204,16 @@ const indicator_line_w = lerpNumber(current_size.w, move_to_size.w, percentage) // 更新指示线 + // #ifdef APP const x = indicator_line_x + indicator_line_w / 2 this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px) scaleX(${indicator_line_w})`) + // #endif + // #ifdef WEB + // TODO chrome windows系统 transform scaleX渲染bug + const x = indicator_line_x + this.indicatorNode?.style?.setProperty('width', `${indicator_line_w}px`) + this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px)`) + // #endif // 滚动到水平中心位置 const scroll_x = x - this.swiperWidth / 2 diff --git a/pages/template/long-list2/long-list2.uvue b/pages/template/long-list2/long-list2.uvue index 810c6c5c..982abb60 100644 --- a/pages/template/long-list2/long-list2.uvue +++ b/pages/template/long-list2/long-list2.uvue @@ -208,8 +208,16 @@ const indicator_line_w = lerpNumber(current_size.w, move_to_size.w, percentage) // 更新指示线 + // #ifdef APP const x = indicator_line_x + indicator_line_w / 2 this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px) scaleX(${indicator_line_w})`) + // #endif + // #ifdef WEB + // TODO chrome windows系统 transform scaleX渲染bug + const x = indicator_line_x + this.indicatorNode?.style?.setProperty('width', `${indicator_line_w}px`) + this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px)`) + // #endif // 滚动到水平中心位置 const scroll_x = x - this.swiperWidth / 2 diff --git a/pages/template/swiper-list/swiper-list.uvue b/pages/template/swiper-list/swiper-list.uvue index f9751f1f..95803abc 100644 --- a/pages/template/swiper-list/swiper-list.uvue +++ b/pages/template/swiper-list/swiper-list.uvue @@ -162,8 +162,16 @@ const indicator_line_w = lerpNumber(current_size.w, move_to_size.w, percentage) // 通过 transform 更新指示线,避免重排版 + // #ifdef APP const x = indicator_line_x + indicator_line_w / 2 - this.indicatorNode!.style.setProperty('transform', `translateX(${x}px) scaleX(${indicator_line_w})`) + this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px) scaleX(${indicator_line_w})`) + // #endif + // #ifdef WEB + // TODO chrome windows系统 transform scaleX渲染bug + const x = indicator_line_x + this.indicatorNode?.style?.setProperty('width', `${indicator_line_w}px`) + this.indicatorNode?.style?.setProperty('transform', `translateX(${x}px)`) + // #endif // 滚动到水平中心位置 const scroll_x = x - this.swiperWidth / 2 -- GitLab