Skip to content

useElementByPoint

Category
Export Size
859 B
Last Changed
11 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

v12.8.0 on
7432f - feat(types): deprecate MaybeRef and MaybeRefOrGetter in favor of Vue's native (#4636)
v12.3.0 on
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.2.0 on
31b66 - feat: new multiple and interval options (#3089)
v10.0.0-beta.4 on
4d757 - feat(types)!: rename MaybeComputedRef to MaybeRefOrGetter
0a72b - feat(toValue): rename resolveUnref to toValue

Released under the MIT License.

40% Off  yearly access to Vue School, Full course library + Vue.js Master Class.
Claim Offer