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: Ref<boolean>
element: Ref<Multiple extends true ? HTMLElement[] : HTMLElement | null>
}
/**
* Reactive element by point.
*
* @see https://vueuse.org.cn/useElementByPoint
* @param options - UseElementByPointOptions
*/
export declare function useElementByPoint<M extends boolean = false>(
options: UseElementByPointOptions<M>,
): UseElementByPointReturn<M>
来源
贡献者
Anthony Fu
Jelf
wheat
Anthony Fu
vaakian X
BaboonKing