fix(Field): emit event after setData when input @rex-zsd (#970)

This commit is contained in:
rex 2018-11-27 21:24:41 +08:00 committed by neverland
parent 8386f66272
commit 4fbc3434d6

View File

@ -79,11 +79,13 @@ VantComponent({
methods: { methods: {
onInput(event: Weapp.Event) { onInput(event: Weapp.Event) {
const { value = '' } = event.detail || {}; const { value = '' } = event.detail || {};
this.$emit('input', value);
this.$emit('change', value);
this.setData({ this.setData({
value, value,
showClear: this.getShowClear(value) showClear: this.getShowClear(value)
}, () => {
this.$emit('input', value);
this.$emit('change', value);
}); });
}, },
@ -120,10 +122,11 @@ VantComponent({
this.setData({ this.setData({
value: '', value: '',
showClear: this.getShowClear('') showClear: this.getShowClear('')
}, () => {
this.$emit('input', '');
this.$emit('change', '');
this.$emit('clear', '');
}); });
this.$emit('input', '');
this.$emit('change', '');
this.$emit('clear', '');
}, },
onConfirm() { onConfirm() {