12345678910111213141516171819202122 |
- import { useRect } from "@vant/use";
- import { ref, onMounted, nextTick } from "vue";
- import { onPopupReopen } from "./on-popup-reopen.mjs";
- const useHeight = (element, withSafeArea) => {
- const height = ref();
- const setHeight = () => {
- height.value = useRect(element).height;
- };
- onMounted(() => {
- nextTick(setHeight);
- if (withSafeArea) {
- for (let i = 1; i <= 3; i++) {
- setTimeout(setHeight, 100 * i);
- }
- }
- });
- onPopupReopen(() => nextTick(setHeight));
- return height;
- };
- export {
- useHeight
- };
|