From a4ce9b955eb7e495700fa841c26436d4ae3b7314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Tue, 18 Feb 2020 09:18:01 +0800 Subject: [PATCH] fix(Swipe): incorrect width when resize in invisible state (#5678) --- src/swipe/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/swipe/index.js b/src/swipe/index.js index ac5c9e121..5616e4df7 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -1,5 +1,6 @@ // Utils import { createNamespace } from '../utils'; +import { isHidden } from '../utils/dom/style'; import { preventDefault } from '../utils/dom/event'; import { doubleRaf } from '../utils/dom/raf'; import { range } from '../utils/format/number'; @@ -149,7 +150,7 @@ export default createComponent({ initialize(active = +this.initialSwipe) { clearTimeout(this.timer); - if (this.$el) { + if (this.$el && !isHidden(this.$el)) { const rect = this.$el.getBoundingClientRect(); this.computedWidth = +this.width || rect.width; this.computedHeight = +this.height || rect.height;