fix(tab): correct line position in complete mode (#3777)

* fix(tab): correct line position in complete mode

fix #3767, fix #3579

* refactor(tabs): remote console.log
This commit is contained in:
rex 2020-11-23 20:06:36 +08:00 committed by GitHub
parent e42169ac51
commit f1ea060b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,7 +225,7 @@ VantComponent({
return; return;
} }
const { currentIndex } = this.data; const { currentIndex, ellipsis } = this.data;
Promise.all([ Promise.all([
getAllRect.call(this, '.van-tab'), getAllRect.call(this, '.van-tab'),
@ -241,7 +241,8 @@ VantComponent({
.slice(0, currentIndex) .slice(0, currentIndex)
.reduce((prev, curr) => prev + curr.width, 0); .reduce((prev, curr) => prev + curr.width, 0);
lineOffsetLeft += (rect.width - lineRect.width) / 2; lineOffsetLeft +=
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
this.setData({ this.setData({
lineOffsetLeft, lineOffsetLeft,