vuestic-ui
Version:
Vue 3 UI Framework
20 lines (19 loc) • 744 B
TypeScript
/**
* Returns computed that emits update:${propName} on edit.
*
* @tutorial
* ```
* const [prop] = useSyncProp('name', props, emit)
*
* prop.value = 'New name'
*
* $nextTick(() => console.log(prop.value)) // 'New name'
* ```
*
* @notice
* Be careful, that property is not updating in current render
* cycle. Be sure to use $nextTick if you need to use this property after change.
*/
export declare function useSyncProp<T, PropName extends string, Props extends {
[key in PropName]?: T;
}, Emit extends (event: any, newValue: Props[PropName]) => any, ReturnValue extends NonNullable<Props[PropName]>>(propName: PropName, props: Props, emit: Emit, defaultValue?: ReturnValue): import("vue").WritableComputedRef<ReturnValue>[];