@aplus-frontend/ui
Version:
18 lines (17 loc) • 629 B
TypeScript
import { Ref } from 'vue';
import { Recordable } from '../type';
type Options<ValueType = any> = {
defaultValue?: ValueType;
defaultValuePropName?: string;
valuePropName?: string;
/**
* 在更新值之前执行,返回false将不更新值,支持异步
* @returns
*/
beforeUpdateValue?: (nextVal: ValueType) => boolean | Promise<boolean>;
};
export declare function useControllableValue<ValueType = any>(props: Recordable, emit: (event: any, ...args: any[]) => void, options?: Options): {
value: Ref<ValueType, ValueType>;
updateValue: (newValue: any) => Promise<void>;
};
export {};