@wfrog/vc
Version:
`自用` 的基于 `element-plus` 二次封装的 `vue3` 组件库。追求在业务场景中,尽可能使用更少的代码量来实现需求。 因此在组件封装上,以 `方便` 为主,打包仅 `esm` 模式。
57 lines (56 loc) • 1.66 kB
TypeScript
import type { ExtractPropTypes, PropType } from 'vue';
export declare type IOption = {
label: string;
value: string | number | boolean;
key?: string | number;
} & Record<string, any>;
export interface IChoiceOptionProps {
key: string;
value: string;
label: string;
}
export declare type IChoiceOption = IOption[] | string[] | number[] | Record<string, string>[] | any[];
export declare const preProps: {
name: {
type: StringConstructor;
default: string;
};
multiple: {
type: BooleanConstructor;
default: boolean;
};
modelValue: {
type: PropType<string | number | boolean | string[] | number[] | boolean[]>;
default: string;
required: boolean;
};
options: {
type: PropType<IChoiceOption | (() => Promise<IChoiceOption>)>;
default: () => never[];
};
props: {
type: PropType<Partial<IChoiceOptionProps>>;
default: () => void;
};
expires: {
type: PropType<number | Date>;
default: number;
};
loadingText: {
type: StringConstructor;
default: string;
};
};
export declare const preEmit: string[];
export interface IContext {
props: ExtractPropTypes<typeof preProps>;
emits: (event: 'update:modelValue' | 'init', ...args: any[]) => void;
}
declare const useChoice: ({ props, emits }: IContext, storagPrefix: string) => {
loading: import("vue").Ref<boolean>;
myOptions: IOption[];
myProps: import("vue").ComputedRef<IChoiceOptionProps>;
myValue: import("vue").WritableComputedRef<any>;
init: () => Promise<void>;
};
export default useChoice;