Category | Component |
---|---|
Export Size | 355 B |
Last Changed | 8 months ago |
Get the DOM element of current component as a ref.
import { useCurrentElement } from '@vueuse/core' const el = useCurrentElement() // ComputedRef<Element>
This functions uses $el
under the hood.
Value of the ref will be undefined
until the component is mounted.
It's recommend to only use this function for components with a single root element.
export declare function useCurrentElement< T extends Element = Element >(): ComputedRefWithControl<T>
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/core/useCurrentElement/