From 3d6a460bd63b07a622452700aabdb38f6fc4f791 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 13 Oct 2020 20:09:59 +0800 Subject: [PATCH] fix(tab): refactor animation without transform (#3668) fix #3659 --- packages/tabs/index.less | 2 +- packages/tabs/index.wxs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/tabs/index.less b/packages/tabs/index.less index 225cb24b..cd01d78d 100644 --- a/packages/tabs/index.less +++ b/packages/tabs/index.less @@ -95,7 +95,7 @@ &--animated { display: flex; - transition-property: transform; + transition-property: left; } } diff --git a/packages/tabs/index.wxs b/packages/tabs/index.wxs index 87b553f5..60c48fd4 100644 --- a/packages/tabs/index.wxs +++ b/packages/tabs/index.wxs @@ -68,10 +68,14 @@ function trackStyle(data) { } return [ - 'transform: translate3d(' + -100 * data.currentIndex + '%, 0, 0)', - '-webkit-transition-duration: ' + data.duration + 's', - 'transition-duration: ' + data.duration + 's', - ].join(';'); + ['left', -100 * data.currentIndex + '%'], + ['-webkit-transition-duration', data.duration + 's'], + ['transition-duration: ', data.duration + 's'], + ] + .map(function (item) { + return item.join(':'); + }) + .join(';'); } function lineStyle(data) {