Skip to content

useElementByPoint

Category
Export Size
859 B
Last Changed
8 months ago

Reactive element by point.

Demo

Usage

ts
import { 
useElementByPoint
,
useMouse
} from '@vueuse/core'
const {
x
,
y
} =
useMouse
({
type
: 'client' })
const {
element
} =
useElementByPoint
({
x
,
y
})

Type Declarations

ts
export interface 
UseElementByPointOptions
<
Multiple
extends boolean = false>
extends ConfigurableDocument {
x
:
MaybeRefOrGetter
<number>
y
:
MaybeRefOrGetter
<number>
multiple
?:
MaybeRefOrGetter
<
Multiple
>
immediate
?: boolean
interval
?: "requestAnimationFrame" | number
} export interface
UseElementByPointReturn
<
Multiple
extends boolean = false>
extends Pausable {
isSupported
:
ComputedRef
<boolean>
element
:
ShallowRef
<
Multiple
extends true ? HTMLElement[] : HTMLElement | null
> } /** * Reactive element by point. * * @see https://vueuse.org/useElementByPoint * @param options - UseElementByPointOptions */ export declare function
useElementByPoint
<
M
extends boolean = false>(
options
:
UseElementByPointOptions
<
M
>,
):
UseElementByPointReturn
<
M
>

Source

SourceDemoDocs

Contributors

Anthony Fu
IlyaL
Anthony Fu
Jelf
wheat
Fernando Fernández
Alex Liu
vaakian X
BaboonKing

Changelog

7432f - feat(types): deprecate MaybeRef and MaybeRefOrGetter in favor of Vue's native (#4636)
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
31b66 - feat: new multiple and interval options (#3089)

Released under the MIT License.