Skip to content

Form 表单

表单系统,包含 Form 和 FormItem,支持校验规则。

基础用法

请选择
vue
<AForm label-width="80px">
  <AFormItem label="用户名" required>
    <AInput placeholder="请输入" clearable />
  </AFormItem>
  <AFormItem label="城市">
    <ASelect :options="[...]" />
  </AFormItem>
</AForm>

行内表单

vue
<AForm inline>
  <AFormItem label="名称"><AInput /></AFormItem>
  <AFormItem><AButton type="primary">搜索</AButton></AFormItem>
</AForm>

API

Form Props

属性类型默认值说明
modelRecord<string, any>{}表单数据
rulesFormRules{}校验规则
size'tiny' | 'small' | 'medium' | 'large''medium'组件尺寸
labelWidthstring | number标签宽度
labelPlacement'left' | 'top''left'标签位置
inlinebooleanfalse行内模式

FormItem Props

属性类型默认值说明
labelstring标签文本
pathstring对应 model 字段
requiredbooleanfalse必填标记
size'tiny' | 'small' | 'medium' | 'large'覆盖 Form 尺寸

Released under the MIT License.