mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-23 18:00:33 +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 | 输入框为空时占位符 | *string* | - | - |
|
||||||
| placeholder-style | 指定占位符的样式 | *string* | - | - |
|
| placeholder-style | 指定占位符的样式 | *string* | - | - |
|
||||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | *string* | `left` | - |
|
| 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
|
### Events
|
||||||
|
|
||||||
@ -90,6 +94,8 @@
|
|||||||
|-----------|-----------|
|
|-----------|-----------|
|
||||||
| action | 自定义搜索框右侧按钮,需要在`use-action-slot`为 true 时才会显示 |
|
| action | 自定义搜索框右侧按钮,需要在`use-action-slot`为 true 时才会显示 |
|
||||||
| label | 自定义搜索框左侧文本 |
|
| label | 自定义搜索框左侧文本 |
|
||||||
|
| left-icon | 自定义输入框左侧图标,需要在`use-left-icon-slot`为 true 时才会显示 |
|
||||||
|
| right-icon | 自定义输入框右侧图标,需要在`use-right-icon-slot`为 true 时才会显示 |
|
||||||
|
|
||||||
### 外部样式类
|
### 外部样式类
|
||||||
|
|
||||||
|
@ -15,6 +15,13 @@ VantComponent({
|
|||||||
inputAlign: String,
|
inputAlign: String,
|
||||||
showAction: Boolean,
|
showAction: Boolean,
|
||||||
useActionSlot: Boolean,
|
useActionSlot: Boolean,
|
||||||
|
useLeftIconSlot: Boolean,
|
||||||
|
useRightIconSlot: Boolean,
|
||||||
|
leftIcon: {
|
||||||
|
type: String,
|
||||||
|
value: 'search'
|
||||||
|
},
|
||||||
|
rightIcon: String,
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
placeholderStyle: String,
|
placeholderStyle: String,
|
||||||
actionText: {
|
actionText: {
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
<van-field
|
<van-field
|
||||||
type="search"
|
type="search"
|
||||||
left-icon="search"
|
left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}"
|
||||||
|
right-icon="{{ !useRightIconSlot ? rightIcon : '' }}"
|
||||||
focus="{{ focus }}"
|
focus="{{ focus }}"
|
||||||
error="{{ error }}"
|
error="{{ error }}"
|
||||||
border="{{ false }}"
|
border="{{ false }}"
|
||||||
@ -31,7 +32,10 @@
|
|||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
bind:confirm="onSearch"
|
bind:confirm="onSearch"
|
||||||
bind:clear="onClear"
|
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>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
|
Loading…
x
Reference in New Issue
Block a user