From 7170bdeacc76d3716486135001b1d107e19bbc30 Mon Sep 17 00:00:00 2001 From: iamkun Date: Mon, 8 Feb 2021 16:06:40 +0800 Subject: [PATCH] fix: fix date picker second clear not trigger change event (#1438) fix #1359 --- packages/time-picker/src/common/picker.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/time-picker/src/common/picker.vue b/packages/time-picker/src/common/picker.vue index a1d77f0e26..8b77089158 100644 --- a/packages/time-picker/src/common/picker.vue +++ b/packages/time-picker/src/common/picker.vue @@ -207,9 +207,9 @@ export default defineComponent({ valueOnOpen.value = props.modelValue } }) - const emitChange = val => { + const emitChange = (val, isClear) => { // determine user real change only - if (!valueEquals(val, valueOnOpen.value)) { + if (isClear || !valueEquals(val, valueOnOpen.value)) { ctx.emit('change', val) props.validateEvent && elFormItem.formItemMitt?.emit('el.form.change', val) } @@ -322,7 +322,7 @@ export default defineComponent({ if (showClose.value) { event.stopPropagation() emitInput(null) - emitChange(null) + emitChange(null, true) showClose.value = false pickerVisible.value = false pickerOptions.value.handleClear && pickerOptions.value.handleClear()