Skip to content

Commit

Permalink
fix(useElementBouding): should reset value while element unmounted (v…
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Feb 13, 2022
1 parent 0e1e211 commit aba020f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/useElementBounding/index.ts
@@ -1,4 +1,4 @@
import { ref } from 'vue-demi'
import { ref, watch } from 'vue-demi'
import { useEventListener } from '../useEventListener'
import type { MaybeElementRef } from '../unrefElement'
import { unrefElement } from '../unrefElement'
Expand Down Expand Up @@ -54,6 +54,8 @@ export function useElementBounding(target: MaybeElementRef) {
update,
)

watch(() => unrefElement(target), ele => !ele && update())

return {
height,
bottom,
Expand Down

0 comments on commit aba020f

Please sign in to comment.