mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix: use-rect add nextTick
This commit is contained in:
parent
fb03ef92c5
commit
53d69b3e3a
@ -1,4 +1,4 @@
|
||||
import { Ref, ref, onMounted } from 'vue';
|
||||
import { Ref, ref, onMounted, nextTick } from 'vue';
|
||||
|
||||
export const useRect = (el: Ref<Element>) => el.value.getBoundingClientRect();
|
||||
|
||||
@ -6,7 +6,9 @@ export const useHeight = (el: Ref<Element>) => {
|
||||
const height = ref();
|
||||
|
||||
onMounted(() => {
|
||||
height.value = useRect(el).height;
|
||||
nextTick(() => {
|
||||
height.value = useRect(el).height;
|
||||
});
|
||||
});
|
||||
|
||||
return height;
|
||||
|
Loading…
x
Reference in New Issue
Block a user