From 73374a8d81b4dbeea4a68074ab197b89e3e240ce Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 7 Sep 2019 19:28:51 +0800 Subject: [PATCH] perf: add transition-property (#1983) --- packages/checkbox/index.less | 3 ++- packages/collapse-item/index.less | 2 +- packages/picker-column/index.ts | 2 +- packages/radio/index.less | 3 ++- packages/swipe-cell/index.ts | 2 +- packages/switch/index.less | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/checkbox/index.less b/packages/checkbox/index.less index 3b397c8a..d487cfc1 100644 --- a/packages/checkbox/index.less +++ b/packages/checkbox/index.less @@ -23,7 +23,8 @@ font-size: 14px; text-align: center; border: 1px solid @checkbox-border-color; - transition: @checkbox-transition-duration; + transition-duration: @checkbox-transition-duration; + transition-property: color, border-color, background-color; &--round { border-radius: 100%; diff --git a/packages/collapse-item/index.less b/packages/collapse-item/index.less index 0d56a58a..245ef536 100644 --- a/packages/collapse-item/index.less +++ b/packages/collapse-item/index.less @@ -4,7 +4,7 @@ &__title { .van-cell__right-icon { transform: rotate(90deg); - transition: @collapse-item-transition-duration; + transition: transform @collapse-item-transition-duration; } &--expanded { diff --git a/packages/picker-column/index.ts b/packages/picker-column/index.ts index 7f11eaf0..df6ffe48 100644 --- a/packages/picker-column/index.ts +++ b/packages/picker-column/index.ts @@ -55,7 +55,7 @@ VantComponent({ wrapperStyle() { const { data } = this; return [ - `transition: ${data.duration}ms`, + `transition: transform ${data.duration}ms`, `transform: translate3d(0, ${data.offset + data.baseOffset}px, 0)`, `line-height: ${data.itemHeight}px` ].join('; '); diff --git a/packages/radio/index.less b/packages/radio/index.less index f9445243..e89e6cbc 100644 --- a/packages/radio/index.less +++ b/packages/radio/index.less @@ -23,7 +23,8 @@ font-size: 14px; text-align: center; border: 1px solid @radio-border-color; - transition: @radio-transition-duration; + transition-duration: @radio-transition-duration; + transition-property: color, border-color, background-color; &--round { border-radius: 100%; diff --git a/packages/swipe-cell/index.ts b/packages/swipe-cell/index.ts index 805c8934..c898ee02 100644 --- a/packages/swipe-cell/index.ts +++ b/packages/swipe-cell/index.ts @@ -45,7 +45,7 @@ VantComponent({ const transform = `translate3d(${offset}px, 0, 0)`; const transition = this.draging ? 'none' - : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)'; + : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)'; this.set({ wrapperStyle: ` diff --git a/packages/switch/index.less b/packages/switch/index.less index be3e5aba..a9353297 100644 --- a/packages/switch/index.less +++ b/packages/switch/index.less @@ -21,7 +21,7 @@ background-color: @switch-node-background-color; border-radius: 100%; box-shadow: @switch-node-box-shadow; - transition: @switch-transition-duration; + transition: transform @switch-transition-duration; } &__loading {