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 <jait.chen@foxmail.com>
This commit is contained in:
Zhousg 2023-04-15 09:28:02 +08:00 committed by GitHub
parent 8bc9b262f2
commit 17055a94c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();