diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts index a2838527..26677a3f 100644 --- a/packages/tabs/index.ts +++ b/packages/tabs/index.ts @@ -225,7 +225,7 @@ VantComponent({ return; } - const { currentIndex } = this.data; + const { currentIndex, ellipsis } = this.data; Promise.all([ getAllRect.call(this, '.van-tab'), @@ -241,7 +241,8 @@ VantComponent({ .slice(0, currentIndex) .reduce((prev, curr) => prev + curr.width, 0); - lineOffsetLeft += (rect.width - lineRect.width) / 2; + lineOffsetLeft += + (rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8); this.setData({ lineOffsetLeft,