ElementConfigForm ​

面向 Element Plus 的配置化表单适配器

使用
反馈
文档

API ​

Props ​

名称类型默认值必填说明
model—是—
columnsnumber | undefined24—原生 CSS Grid 的列数。
gapstring | undefined——原生 Grid/Flex 的间距。
components——语义组件别名注册表;与 Element Plus 默认别名合并。
fields—是表单节点配置;字段节点绑定表单值,容器节点只渲染组件和 slots。
defaultValues——reset 使用的显式初始值;未提供时捕获首次 model。
readonly——表单级展示态;命中后所有字段进入 readonly。
readonlyRender——字段未声明 readonlyRender 时使用的表单级展示渲染函数。
formAttrsFormHTMLAttributes | undefined{}—透传给 renderer 原生 form 壳的 attributes。
inlineboolean | undefined——是否使用行内布局;行内布局使用 Flex 容器,不消费 span 或 cellAttrs。
layoutAttrsHTMLAttributes | undefined{}—透传给 renderer 原生 Grid/Flex 布局容器的 attributes。
cellAttrsHTMLAttributes | undefined{}—透传给 renderer 原生 grid cell 的默认 attributes;仅 grid 布局消费。
fieldSpannumber | undefined24—grid 布局下的字段默认栅格跨度。

Emits ​

名称参数说明
change任意字段写入后触发,返回完整表单值。
fieldChange单字段写入后触发,返回字段维度变更信息。
metaChangedirty 或 touched 状态变化后触发。
submitsubmit 校验通过后触发。
errorsubmit 校验未通过时触发,透出 Headless 标准错误集合。

Slots ​

名称作用域说明
default默认 slot 通常用于放置提交、重置等表单操作区。
actionsNamed operation area; the renderer can keep it visible on long forms.

Expose ​

名称类型说明
getVariables() => Readonly<Record<string, unknown>>—
getDataSourceStateLatest started consumer for this source/scope; per-field state uses getOptionState.
loadDataSource—
getOptionState—
scrollToField(field: string) => void—
scrollToFirstError() => void—
submit() => Promise<boolean>—
appendRow—
applyFieldInstanceChangeExact component write path for object/array field instances.
clearInstanceValidate—
clearValidate—
duplicateRow—
getErrors—
getFieldMeta—
getInstanceErrors—
getInstanceKey—
getInstanceMeta—
getInstanceValue—
getIssues—
getMeta—
getValidating() => boolean—
getValue—
getValues—
insertRow—
isInstanceValidating—
listFieldInstances—
listRows—
moveRow—
removeRow—
resetFields—
setErrors—
setInstanceTouched—
setInstanceValue—
setTouched—
setValue—
setValues—
validate() => Promise<boolean>—
validateField—
validateInstance—

组件贡献者 ​