Skip to content

Commit

Permalink
fix(useElementHover): support set el ref type (#2079)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiatLn committed Aug 12, 2022
1 parent a63122b commit d9c0cd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/useElementHover/demo.vue
Expand Up @@ -2,7 +2,7 @@
import { ref } from 'vue'
import { useElementHover } from '@vueuse/core'
const el = ref()
const el = ref<HTMLButtonElement>()
const isHovered = useElementHover(el)
</script>

Expand Down
2 changes: 1 addition & 1 deletion packages/core/useElementHover/index.ts
Expand Up @@ -3,7 +3,7 @@ import { ref } from 'vue-demi'
import type { MaybeComputedRef } from '@vueuse/shared'
import { useEventListener } from '../useEventListener'

export function useElementHover(el: MaybeComputedRef<EventTarget>): Ref<boolean> {
export function useElementHover(el: MaybeComputedRef<EventTarget | null | undefined>): Ref<boolean> {
const isHovered = ref(false)

useEventListener(el, 'mouseenter', () => isHovered.value = true)
Expand Down

0 comments on commit d9c0cd0

Please sign in to comment.