mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Search): add some icon props (#2051)
This commit is contained in:
parent
86ed4f6b3a
commit
b6c8ef9fbf
@ -72,6 +72,10 @@
|
||||
| placeholder | 输入框为空时占位符 | *string* | - | - |
|
||||
| placeholder-style | 指定占位符的样式 | *string* | - | - |
|
||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | *string* | `left` | - |
|
||||
| use-left-icon-slot | 是否使用输入框左侧图标 slot | *boolean* | `false` | - |
|
||||
| use-right-icon-slot | 是否使用输入框右侧图标 slot | *boolean* | `false` | - |
|
||||
| left-icon | 输入框左侧图标名称或图片链接,可选值见 Icon 组件(如果设置了use-left-icon-slot,则该属性无效) | *string* | `search` | - |
|
||||
| right-icon | 输入框右侧图标名称或图片链接,可选值见 Icon 组件(如果设置了use-right-icon-slot,则该属性无效) | *string* | - | - |
|
||||
|
||||
### Events
|
||||
|
||||
@ -90,6 +94,8 @@
|
||||
|-----------|-----------|
|
||||
| action | 自定义搜索框右侧按钮,需要在`use-action-slot`为 true 时才会显示 |
|
||||
| label | 自定义搜索框左侧文本 |
|
||||
| left-icon | 自定义输入框左侧图标,需要在`use-left-icon-slot`为 true 时才会显示 |
|
||||
| right-icon | 自定义输入框右侧图标,需要在`use-right-icon-slot`为 true 时才会显示 |
|
||||
|
||||
### 外部样式类
|
||||
|
||||
|
@ -15,6 +15,13 @@ VantComponent({
|
||||
inputAlign: String,
|
||||
showAction: Boolean,
|
||||
useActionSlot: Boolean,
|
||||
useLeftIconSlot: Boolean,
|
||||
useRightIconSlot: Boolean,
|
||||
leftIcon: {
|
||||
type: String,
|
||||
value: 'search'
|
||||
},
|
||||
rightIcon: String,
|
||||
placeholder: String,
|
||||
placeholderStyle: String,
|
||||
actionText: {
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
<van-field
|
||||
type="search"
|
||||
left-icon="search"
|
||||
left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}"
|
||||
right-icon="{{ !useRightIconSlot ? rightIcon : '' }}"
|
||||
focus="{{ focus }}"
|
||||
error="{{ error }}"
|
||||
border="{{ false }}"
|
||||
@ -31,7 +32,10 @@
|
||||
bind:change="onChange"
|
||||
bind:confirm="onSearch"
|
||||
bind:clear="onClear"
|
||||
/>
|
||||
>
|
||||
<slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
|
||||
<slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
|
||||
</van-field>
|
||||
</view>
|
||||
|
||||
<view
|
||||
|
Loading…
x
Reference in New Issue
Block a user