feat(Field): add icon-prefix prop (#5666)

This commit is contained in:
chenjiahan 2020-02-28 15:46:54 +08:00
parent 05966e0469
commit 876b899fec
3 changed files with 8 additions and 2 deletions

View File

@ -242,6 +242,7 @@ Use `input-align` prop to align the input value
| 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* | - |
| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` |
| rules `v2.5.0` | Form validation rules | *Rule[]* | - |
### Events

View File

@ -261,6 +261,7 @@ export default {
| autosize | 是否自适应内容高度,只对 textarea 有效,<br>可传入对象,如 { maxHeight: 100, minHeight: 50 }<br>单位为`px` | *boolean \| object* | `false` |
| left-icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | *string* | - |
| right-icon | 右侧[图标名称](#/zh-CN/icon)或图片链接 | *string* | - |
| icon-prefix `v2.5.3` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | *string* | `van-icon` |
| rules `v2.5.0` | 表单校验规则,详见 [Form 组件](#/zh-CN/form#rule-shu-ju-jie-gou) | *Rule[]* | - |
### Events

View File

@ -437,7 +437,9 @@ export default createComponent({
if (showLeftIcon) {
return (
<div class={bem('left-icon')} onClick={this.onClickLeftIcon}>
{this.slots('left-icon') || <Icon name={this.leftIcon} />}
{this.slots('left-icon') || (
<Icon name={this.leftIcon} classPrefix={this.iconPrefix} />
)}
</div>
);
}
@ -450,7 +452,9 @@ export default createComponent({
if (showRightIcon) {
return (
<div class={bem('right-icon')} onClick={this.onClickRightIcon}>
{slots('right-icon') || <Icon name={this.rightIcon} />}
{slots('right-icon') || (
<Icon name={this.rightIcon} classPrefix={this.iconPrefix} />
)}
</div>
);
}