8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc6f2e8 commit 5f545beCopy full SHA for 5f545be
packages/core/useElementSize/index.ts
@@ -25,7 +25,7 @@ export function useElementSize(
25
const width = ref(initialSize.width)
26
const height = ref(initialSize.height)
27
28
- useResizeObserver(
+ const { stop: stop1 } = useResizeObserver(
29
target,
30
([entry]) => {
31
const boxSize = box === 'border-box'
@@ -58,17 +58,23 @@ export function useElementSize(
58
options,
59
)
60
61
- watch(
+ const stop2 = watch(
62
() => unrefElement(target),
63
(ele) => {
64
width.value = ele ? initialSize.width : 0
65
height.value = ele ? initialSize.height : 0
66
},
67
68
69
+ function stop() {
70
+ stop1()
71
+ stop2()
72
+ }
73
+
74
return {
75
width,
76
height,
77
+ stop,
78
}
79
80
0 commit comments