Skip to content

[Form] 验证的错误消息可以使用 FormItem 的 label 作为字段名称 #936

@wensonsmith

Description

@wensonsmith
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Edit Form Item Label

假如有以下 Form

<Form>
    <FormItem label="名称">
        <Input v-decorator="['name', {rules:[{required:true}]}]"/>
    </FormItem>
</Form>

如果我们修改

validateMessages { required: '%s 是必须的'}

这样能把所有必填项信息修改了,但是 %s 获取到是decorator 的 id 值,这样提示出来的信息是

name 是必须的

希望可以支持使用FormItem 的 label 值, 显示

名称是必须的

What does the proposed API look like?

例如 v-decoraor="['name', {label: true}]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions