Commit 118f7da8 authored by chenshouchao's avatar chenshouchao

feat: MySelect组件提供options装换方法

parent 37c40624
......@@ -18,6 +18,17 @@ export interface IOption {
value: string;
disabled?: boolean;
}
export const optionsTransform = (arr: Array<any>, labelKey: string = 'label', valueKey: string = 'value', disabledKey: string = 'disabled'):Array<IOption> => {
return arr.map((item: any) => {
return {
label: item[labelKey],
value: item[valueKey],
disabled: item[disabledKey]
}
})
}
interface IProps
extends Omit<SelectProps, "value" | "options" | "onChange" | "title"> {
value?: IOption;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment