From 02bfde1db27eaffe93b28c84122e6d4a37f531f1 Mon Sep 17 00:00:00 2001 From: Younntone <35844796+Ellean@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:10:30 +0800 Subject: [PATCH] Update u-tabs.vue more adaptable & clean --- uni_modules/uview-ui/components/u-tabs/u-tabs.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/uni_modules/uview-ui/components/u-tabs/u-tabs.vue b/uni_modules/uview-ui/components/u-tabs/u-tabs.vue index d2b3b039..9e3f3cc3 100644 --- a/uni_modules/uview-ui/components/u-tabs/u-tabs.vue +++ b/uni_modules/uview-ui/components/u-tabs/u-tabs.vue @@ -163,9 +163,7 @@ return; } // 获取滑块该移动的位置 - let lineOffsetLeft = this.list - .slice(0, this.innerCurrent) - .reduce((total, curr) => total + curr.rect.width, 0); + let lineOffsetLeft = tabItem.rect.left; // 获取下划线的数值px表示法 const lineWidth = uni.$u.getPx(this.lineWidth); this.lineOffsetLeft = lineOffsetLeft + (tabItem.rect.width - lineWidth) / 2