fix(Field): catch touchstart event to fix #1430 (#2602)

fix #1430
This commit is contained in:
rex 2019-12-26 14:28:34 +08:00 committed by GitHub
parent 72e992e56e
commit a44b3b4ed9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -83,7 +83,9 @@ VantComponent({
onInput(event: Weapp.Event) {
const { value = '' } = event.detail || {};
this.setData({ value }, () => {
this.setData({ value });
wx.nextTick(() => {
this.emitChange(value);
});
},
@ -103,7 +105,9 @@ VantComponent({
},
onClear() {
this.setData({ value: '' }, () => {
this.setData({ value: '' });
wx.nextTick(() => {
this.emitChange('');
this.$emit('clear', '');
});
@ -116,6 +120,8 @@ VantComponent({
emitChange(value) {
this.$emit('input', value);
this.$emit('change', value);
}
},
noop() {}
}
});

View File

@ -70,7 +70,7 @@
size="16px"
name="clear"
class="van-field__clear-root van-field__icon-root"
bindtouchstart="onClear"
catch:touchstart="onClear"
/>
<view class="van-field__icon-container" bind:tap="onClickIcon">
<van-icon