From 2c30e7ba68496d3940e69f95ff82f927d64b8a3b Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 3 Dec 2022 20:01:12 +0800 Subject: [PATCH] fix(NavBar): update placeholder height when window resized (#11351) --- packages/vant/src/composables/use-height.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/composables/use-height.ts b/packages/vant/src/composables/use-height.ts index 083deccf2..68df222aa 100644 --- a/packages/vant/src/composables/use-height.ts +++ b/packages/vant/src/composables/use-height.ts @@ -1,5 +1,6 @@ import { useRect } from '@vant/use'; -import { Ref, ref, onMounted, nextTick } from 'vue'; +import { Ref, ref, onMounted, nextTick, watch } from 'vue'; +import { windowHeight, windowWidth } from '../utils'; import { onPopupReopen } from './on-popup-reopen'; export const useHeight = ( @@ -32,5 +33,9 @@ export const useHeight = ( // https://github.com/vant-ui/vant/issues/10628 onPopupReopen(() => nextTick(setHeight)); + // The height of the element may change when the window is resized + // https://github.com/youzan/vant/issues/11325 + watch([windowWidth, windowHeight], setHeight); + return height; };