From 17055a94c7347d0a9071c6e61dcb599b2aa792e2 Mon Sep 17 00:00:00 2001 From: Zhousg Date: Sat, 15 Apr 2023 09:28:02 +0800 Subject: [PATCH] fix(Swipe): should resize after props.width/height changed (#11747) * fix(Swipe): props changed but component didn't * fix(Swipe): target watch windowWidth * Update packages/vant/src/swipe/Swipe.tsx --------- Co-authored-by: neverland --- packages/vant/src/swipe/Swipe.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/swipe/Swipe.tsx b/packages/vant/src/swipe/Swipe.tsx index 2036cb3c5..420502eba 100644 --- a/packages/vant/src/swipe/Swipe.tsx +++ b/packages/vant/src/swipe/Swipe.tsx @@ -457,7 +457,10 @@ export default defineComponent({ watch(count, () => initialize(state.active)); watch(() => props.autoplay, autoplay); - watch([windowWidth, windowHeight], resize); + watch( + [windowWidth, windowHeight, () => props.width, () => props.height], + resize + ); watch(usePageVisibility(), (visible) => { if (visible === 'visible') { autoplay();