fn
useMounted
v0.0.1testeddemoReturns a ref that tracks the mounted state of the component (doesn't track the unmounted state)
Examples
ts
const isMounted = useMounted();ts
const isMounted = useMounted(getCurrentInstance());Demo
Loading demo…
Signature
ts
export function useMounted(instance?: ComponentInternalInstance){ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
instance? | ComponentInternalInstance | undefined | The component instance to track the mounted state for |
Returns
Readonly<import("vue").Ref<boolean, boolean>>The mounted state of the component