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