From a0bfe6959b337fb93eab2db67e617f3b2629bddd Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 13 Feb 2019 16:24:21 +0800 Subject: [PATCH] [bugfix] Tab: should not have line animation when inited (#1295) --- packages/tabs/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts index 8c572278..863cae5e 100644 --- a/packages/tabs/index.ts +++ b/packages/tabs/index.ts @@ -104,7 +104,7 @@ VantComponent({ }, mounted() { - this.setLine(); + this.setLine(true); this.setTrack(); this.scrollIntoView(); }, @@ -148,7 +148,7 @@ VantComponent({ } }, - setLine() { + setLine(skipTransition?: boolean) { if (this.data.type !== 'line') { return; } @@ -172,15 +172,16 @@ VantComponent({ left += (rect.width - width) / 2; + const transition = skipTransition ? '' : `transition-duration: ${duration}s; -webkit-transition-duration: ${duration}s;`; + this.set({ lineStyle: ` ${height} width: ${width}px; background-color: ${color}; -webkit-transform: translateX(${left}px); - -webkit-transition-duration: ${duration}s; transform: translateX(${left}px); - transition-duration: ${duration}s; + ${transition} ` }); });