useElementByPoint
根据点获取响应式元素。
示例
用法
ts
import { useElementByPoint, useMouse } from '@vueuse/core'
const { x, y } = useMouse({ type: 'client' })
const { element } = useElementByPoint({ x, y })
类型声明
typescript
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: Ref<Multiple extends true ? HTMLElement[] : HTMLElement | null>
}
/**
* 根据点获取响应式元素。
*
* @see https://vueuse.org/useElementByPoint
* @param options - UseElementByPointOptions
*/
export declare function useElementByPoint<M extends boolean = false>(
options: UseElementByPointOptions<M>,
): UseElementByPointReturn<M>
源码
贡献者
Anthony Fu
一纸忘忧
Anthony Fu
Jelf
wheat
Fernando Fernández
Alex Liu
vaakian X
BaboonKing
更新日志
v12.3.0
on 1/2/202559f75
- feat(toValue): deprecate toValue
from @vueuse/shared
in favor of Vue's nativev12.0.0-beta.1
on 11/21/2024v10.2.0
on 6/16/2023v10.0.0-beta.4
on 4/13/20234d757
- feat(types)!: rename MaybeComputedRef
to MaybeRefOrGetter
0a72b
- feat(toValue): rename resolveUnref
to toValue
v9.11.0
on 1/17/2023