form.d.ts
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { CSSProperties } from 'vue'
import { ColProps, ComponentProps, ComponentName } from '@/types/components'
import type { AxiosPromise } from 'axios'
export type FormSetPropsType = {
field: string
path: string
value: any
}
export type FormValueType = string | number | string[] | number[] | boolean | undefined | null
export type FormItemProps = {
labelWidth?: string | number
required?: boolean
rules?: Recordable
error?: string
showMessage?: boolean
inlineMessage?: boolean
style?: CSSProperties
}
export type FormSchema = {
// 唯一值
field: string
// 标题
label?: string
// 提示
labelMessage?: string
// col组件属性
colProps?: ColProps
// 表单组件属性,slots对应的是表单组件的插槽,规则:${field}-xxx,具体可以查看element-plus文档
componentProps?: { slots?: Recordable } & ComponentProps
// formItem组件属性
formItemProps?: FormItemProps
// 渲染的组件
component?: ComponentName
// 初始值
value?: FormValueType
// 是否隐藏
hidden?: boolean
// 远程加载下拉项
api?: <T = any>() => AxiosPromise<T>
}