Function: useLocalState()
ts
function useLocalState<T>(
emit: EmitWithUpdateModelValue<T>,
onUpdateModelValueCamelProp: (
val: T | T[] | null | undefined,
) => void | undefined,
onUpdateModelValueKebabProp: (
val: T | T[] | null | undefined,
) => void | undefined,
multiple: Ref<boolean>,
modelValueRef: Ref<T | T[] | null | undefined>,
modelValueProp: T | T[] | null | undefined,
onChange: (
is: LocalStateModelValue<T>,
was?: LocalStateModelValue<T>,
) => void,
): {
getLocalState: () => any;
localState: WritableComputedRef<any, T | T[] | null | undefined>;
recomputeLocalState: () => void;
setLocalState: (val: T | T[] | null | undefined) => void;
};Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
emit | EmitWithUpdateModelValue<T> |
onUpdateModelValueCamelProp | (val: T | T[] | null | undefined) => void | undefined |
onUpdateModelValueKebabProp | (val: T | T[] | null | undefined) => void | undefined |
multiple | Ref<boolean> |
modelValueRef | Ref<T | T[] | null | undefined> |
modelValueProp | T | T[] | null | undefined |
onChange | (is: LocalStateModelValue<T>, was?: LocalStateModelValue<T>) => void |
Returns
ts
{
getLocalState: () => any;
localState: WritableComputedRef<any, T | T[] | null | undefined>;
recomputeLocalState: () => void;
setLocalState: (val: T | T[] | null | undefined) => void;
}| Name | Type | Default value |
|---|---|---|
getLocalState() | () => any | - |
localState | WritableComputedRef<any, T | T[] | null | undefined> | - |
recomputeLocalState() | () => void | recomputeLocalStateValue |
setLocalState() | (val: T | T[] | null | undefined) => void | setLocalStateRefValue |