Form: Add label slot

pull/4986/head
Liril 2017-05-03 17:51:18 +08:00 committed by 杨奕
parent 6ee73f7715
commit bf7eabb64d
3 changed files with 14 additions and 1 deletions

View File

@ -765,3 +765,10 @@ Form component allows you to verify your data, helping you find and correct erro
| rules | validation rules of form | object | — | — |
| error | field error message, set its value and the field will validate error and show this message immediately | string | — | — |
| show-message | whether to show the error message | boolean | — | true |
### Form-Item Slot
| name | Description |
|------|--------|
| — | content of Form Item |
| label | content of label |

View File

@ -753,3 +753,9 @@
| rules | 表单验证规则 | object | — | — |
| error | 表单域验证错误信息, 设置该值会使表单验证状态变为`error`,并显示该错误信息 | string | — | — |
| show-message | 是否显示校验错误信息 | boolean | — | true |
### Form-Item Slot
| name | 说明 |
|------|--------|
| — | Form Item 的内容 |
| label | 标签文本的内容 |

View File

@ -5,7 +5,7 @@
'is-required': isRequired || required
}">
<label :for="prop" class="el-form-item__label" v-bind:style="labelStyle" v-if="label">
{{label + form.labelSuffix}}
<slot name="label">{{label + form.labelSuffix}}</slot>
</label>
<div class="el-form-item__content" v-bind:style="contentStyle">
<slot></slot>