mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[improvement] Search&Field: add clear event. (#894)
This commit is contained in:
parent
6060554fa6
commit
38cb8ca4f6
@ -25,5 +25,12 @@ Page({
|
||||
title: '取消',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
|
||||
onClear() {
|
||||
wx.showToast({
|
||||
title: '清空',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -15,6 +15,7 @@
|
||||
bind:change="onChange"
|
||||
bind:search="onSearch"
|
||||
bind:cancel="onCancel"
|
||||
bind:clear="onClear"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
|
@ -172,6 +172,7 @@ Page({
|
||||
| bind:click-icon | 点击尾部图标时触发 | - |
|
||||
| bind:focus | 输入框聚焦时触发 | - |
|
||||
| bind:blur | 输入框失焦时触发 | - |
|
||||
| bind:clear | 点击清空控件时触发 | - |
|
||||
|
||||
### Slot
|
||||
|
||||
|
@ -115,6 +115,7 @@ VantComponent({
|
||||
});
|
||||
this.$emit('input', '');
|
||||
this.$emit('change', '');
|
||||
this.$emit('clear', '');
|
||||
},
|
||||
|
||||
onConfirm() {
|
||||
|
@ -70,6 +70,7 @@ Search 支持自定义右侧取消按钮,使用名字为 action 的 slot 即
|
||||
| bind:cancel | 取消搜索搜索时触发 | - |
|
||||
| bind:focus | 输入框聚焦时触发 | - |
|
||||
| bind:blur | 输入框失焦时触发 | - |
|
||||
| bind:clear | 点击清空控件时触发 | - |
|
||||
|
||||
### Slot
|
||||
|
||||
|
@ -47,6 +47,10 @@ VantComponent({
|
||||
|
||||
onBlur() {
|
||||
this.$emit('blur');
|
||||
}
|
||||
},
|
||||
|
||||
onClear() {
|
||||
this.$emit('clear');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
@ -23,6 +23,7 @@
|
||||
bind:focus="onFocus"
|
||||
bind:change="onChange"
|
||||
bind:confirm="onSearch"
|
||||
bind:clear="onClear"
|
||||
/>
|
||||
<view wx:if="{{ showAction || useActionSlot }}" class="van-search__action">
|
||||
<slot wx:if="{{ useActionSlot }}" name="action" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user