mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-01 05:39:45 +08:00
fix(NavBar): update placeholder height when window resized (#11351)
This commit is contained in:
parent
7919ea2b8b
commit
2c30e7ba68
@ -1,5 +1,6 @@
|
|||||||
import { useRect } from '@vant/use';
|
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';
|
import { onPopupReopen } from './on-popup-reopen';
|
||||||
|
|
||||||
export const useHeight = (
|
export const useHeight = (
|
||||||
@ -32,5 +33,9 @@ export const useHeight = (
|
|||||||
// https://github.com/vant-ui/vant/issues/10628
|
// https://github.com/vant-ui/vant/issues/10628
|
||||||
onPopupReopen(() => nextTick(setHeight));
|
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;
|
return height;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user