[Improvement] Field: add label slot (#1048)

This commit is contained in:
neverland 2018-05-12 11:17:08 +08:00 committed by GitHub
parent 9d8b615392
commit 60e183f76d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -113,9 +113,9 @@ Filed support all native properties of input tagsuch as `maxlength`、`placeh
| Attribute | Description | Type | Default | | Attribute | Description | Type | Default |
|-----------|-----------|-----------|-------------| |-----------|-----------|-----------|-------------|
| type | Input type | `String` | `text` |
| value | Filed value | `String` | - | | value | Filed value | `String` | - |
| label | Filed label | `String` | - | | label | Filed label | `String` | - |
| type | Input type | `String` | `text` |
| disabled | Disable field | `Boolean` | `false` | | disabled | Disable field | `Boolean` | `false` |
| error | Whether to show error info | `Boolean` | `false` | | error | Whether to show error info | `Boolean` | `false` |
| error-message | Error message | `String` | `''` | | error-message | Error message | `String` | `''` |
@ -133,5 +133,6 @@ Filed support all native events of input tagsuch as `focus`、`blur`、`keypr
| name | Description | | name | Description |
|-----------|-----------| |-----------|-----------|
| label | Custom label |
| icon | Custom icon | | icon | Custom icon |
| button | Insert button | | button | Insert button |

View File

@ -115,12 +115,12 @@ Filed 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`pla
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------|-------------| |-----------|-----------|-----------|-------------|-------------|
| label | 标签 | `String` | - |
| value | 当前输入的值 | `String` | - |
| type | 可设置为任意原生类型, 如 `number` `tel` `textarea` | `String` | `text` | | type | 可设置为任意原生类型, 如 `number` `tel` `textarea` | `String` | `text` |
| value | 输入框的值 | `String` | - |
| label | 输入框标签 | `String` | - |
| disabled | 是否禁用输入框 | `Boolean` | `false` | | disabled | 是否禁用输入框 | `Boolean` | `false` |
| error | 输入框是否有错误 | `Boolean` | `false` | | error | 是否将输入内容标红 | `Boolean` | `false` |
| error-message | 输入框底部错误提示文案 | `String` | `''` | | error-message | 底部错误提示文案 | `String` | `''` |
| autosize | 自适应内容高度,只对 textarea 有效,可传入对象,如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` | | autosize | 自适应内容高度,只对 textarea 有效,可传入对象,如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` |
| icon | 输入框尾部图标 (可选值见 Icon 组件) | `String` | - | | icon | 输入框尾部图标 (可选值见 Icon 组件) | `String` | - |
@ -135,5 +135,6 @@ Filed 默认支持 Input 标签所有的原生事件,如 `focus`、`blur`、`k
| 名称 | 说明 | | 名称 | 说明 |
|-----------|-----------| |-----------|-----------|
| label | 自定义输入框标签 |
| icon | 自定义输入框尾部图标 | | icon | 自定义输入框尾部图标 |
| button | 自定义输入框尾部按钮 | | button | 自定义输入框尾部按钮 |

View File

@ -11,6 +11,7 @@
'min-height': type === 'textarea' && !autosize 'min-height': type === 'textarea' && !autosize
})" })"
> >
<slot name="label" slot="title" />
<textarea <textarea
v-if="type === 'textarea'" v-if="type === 'textarea'"
v-bind="$attrs" v-bind="$attrs"