Skip to content

Commit 5a35924

Browse files
authored
fix(core): reposition FloatingPopover on window resize (#403)
1 parent c79df41 commit 5a35924

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/core/src/client/webcomponents/components/floating/FloatingPopover.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { PropType, VNode } from 'vue'
22
import type { FloatingPopoverProps } from '../../state/floating-tooltip'
3-
import { onClickOutside, useDebounceFn } from '@vueuse/core'
3+
import { onClickOutside, useDebounceFn, useEventListener } from '@vueuse/core'
44
import { defineComponent, h, ref, useTemplateRef, watch } from 'vue'
55

66
// @unocss-include
@@ -26,6 +26,11 @@ const FloatingPopoverComponent = defineComponent({
2626
const el = ref(props.item?.el)
2727
const renderCounter = ref(0)
2828

29+
useEventListener(window, 'resize', () => {
30+
if (el.value)
31+
renderCounter.value++
32+
})
33+
2934
const clearThrottled = useDebounceFn(() => {
3035
if (props.item?.el == null)
3136
el.value = undefined

0 commit comments

Comments
 (0)