fix: fix date picker second clear not trigger change event (#1438)

fix #1359
This commit is contained in:
iamkun 2021-02-08 16:06:40 +08:00 committed by GitHub
parent 82482a2076
commit 7170bdeacc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()