Skip to content
On this page

useElementByPoint

以坐标点响应式操作元素。

Reactive element by point.

例子

X
Y

Usage

ts
import { useElementByPoint, useMouse } from '@vueuse/core'

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

const { x, y } = useMouse({ type: 'client' })
const { element } = useElementByPoint({ x, y })

Type Declarations

typescript
export interface UseElementByPointOptions extends ConfigurableDocument {
  x: MaybeComputedRef<number>
  y: MaybeComputedRef<number>
}
/**
 * Reactive element by point.
 *
 * @see https://vueuse.org/useElementByPoint
 * @param options - UseElementByPointOptions
 */
export declare function useElementByPoint(options: UseElementByPointOptions): {
  isActive: Readonly<Ref<boolean>>
  pause: Fn
  resume: Fn
  element: Ref<HTMLElement | null>
}
export type UseElementByPointReturn = ReturnType<typeof useElementByPoint>
export interface UseElementByPointOptions extends ConfigurableDocument {
  x: MaybeComputedRef<number>
  y: MaybeComputedRef<number>
}
/**
 * Reactive element by point.
 *
 * @see https://vueuse.org/useElementByPoint
 * @param options - UseElementByPointOptions
 */
export declare function useElementByPoint(options: UseElementByPointOptions): {
  isActive: Readonly<Ref<boolean>>
  pause: Fn
  resume: Fn
  element: Ref<HTMLElement | null>
}
export type UseElementByPointReturn = ReturnType<typeof useElementByPoint>

Source

Category
Export Size
1.05 kB
Last Changed
3 months ago

SourceDemoDocs

贡献者(Contributors)

日志(Changelog)

No recent changes

Released under the MIT License.