一、json格式
二、定义表单项类型
根据element-plus组件的使用,定义必传和可选项以及类型
1.type 渲染的element-plus组件元素名
2.value 表单的值
3.label 标签名
4.prop 表单域model的字段,使用验证和清空时必填
5.rules 表单项验证规则
element验证是基于async-validator工具的,验证项类型直接从github上复制即可。
6.attrs 表单元素特有的属性
用来传递某个表单元素特有的属性,通过v-bind=’ $attrs ‘,给element-plus原组件绑定
// 表单每一项的配置选项export interface FormOptions {// 表单项显示的元素type: 'cascader' | 'checkbox' | 'checkbox-group' | 'checkbox-button' | 'color-picker' |'date-picker' | 'input' | 'input-number' | 'radio' | 'radio-group' | 'radio-button' | 'rate' |'select' | 'option' | 'slider' | 'switch' | 'time-picker' | 'time-select' |'transfer' | 'upload' | 'editor',// 表单项的值value?: any,// 表单项labellabel?: string,// 表单项的标识prop?: string,// 表单项的验证规则rules?: RuleItem[],// 表单项的占位符placeholder?: string,// 表单元素特有的属性attrs?: {// css样式style?: CSSProperties,clearable?: boolean,showPassword?: boolean,disabled?: boolean,},// 表单项的子元素children?: FormOptions[],// 处理上传组件的属性和方法uploadAttrs?: {action: string,headers?: object,method?: 'post' | 'put' | 'patch',multiple?: boolean,data?: any,name?: string,withCredentials?: boolean,showFileList?: boolean,drag?: boolean,accept?: string,thumbnailMode?: boolean,fileList?: any[],listType?: 'text' | 'picture' | 'picture-card',autoUpload?: boolean,disabled?: boolean,limit?: number,}}
