[new feature] Field: add error-message-align prop (#3016)

This commit is contained in:
Super 2019-03-20 20:21:15 +08:00 committed by neverland
parent cc997be877
commit 2d6269fba8
4 changed files with 11 additions and 1 deletions

View File

@ -129,6 +129,7 @@ Field support all native properties of input tagsuch as `maxlength`、`placeh
| error-message | Error message | `String` | `''` |
| label-align | Label text align, can be set to `center` `right` | `String` | `left` |
| input-align | Input text align, can be set to `center` `right` | `String` | `left` |
| error-message-align | Error message text align, can be set to `center` `right` | `String` | `left` |
| autosize | Textarea auto resizecan accpet an object,<br>e.g. { maxHeight: 100, minHeight: 50 } | `Boolean | Object` | `false` |
| left-icon | Left side icon name | `String` | - |
| right-icon | Right side icon name | `String` | - |

View File

@ -20,6 +20,7 @@ export default sfc({
onIconClick: Function,
autosize: [Boolean, Object],
errorMessage: String,
errorMessageAlign: String,
type: {
type: String,
default: 'text'
@ -243,7 +244,7 @@ export default sfc({
{this.renderRightIcon()}
{slots('button') && <div class={bem('button')}>{slots('button')}</div>}
</div>
{this.errorMessage && <div class={bem('error-message')}>{this.errorMessage}</div>}
{this.errorMessage && <div class={bem('error-message', this.errorMessageAlign)}>{this.errorMessage}</div>}
</Cell>
);
}

View File

@ -98,6 +98,13 @@
color: @red;
font-size: 12px;
text-align: left;
&--center {
text-align: center;
}
&--right {
text-align: right;
}
}
&--disabled {

View File

@ -131,6 +131,7 @@ Field 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`pla
| error-message | 底部错误提示文案,为空时不展示 | `String` | `''` | - |
| label-align | 文本对齐方式,可选值为 `center` `right` | `String` | `left` | 1.1.10 |
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | `String` | `left` | 1.1.10 |
| error-message-align | 错误提示文案对齐方式,可选值为 `center` `right` | `String` | `left` | - |
| autosize | 自适应内容高度,只对 textarea 有效,可传入对象,<br>如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` | 1.0.0 |
| left-icon | 输入框左侧图标名称或图片链接,可选值见 Icon 组件 | `String` | - | 1.5.7 |
| right-icon | 输入框尾部图标名称或图片链接,可选值见 Icon 组件 | `String` | - | 1.5.7 |