From bcc4f77356cd9a3c92b5ebd734145d5a89069078 Mon Sep 17 00:00:00 2001 From: mengxiong10 <15623530290@163.com> Date: Mon, 23 Nov 2020 14:21:52 +0800 Subject: [PATCH] fix: clear text error (#544) --- src/date-picker.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/date-picker.js b/src/date-picker.js index c16bd51..b6ba639 100644 --- a/src/date-picker.js +++ b/src/date-picker.js @@ -331,11 +331,14 @@ export default { this.emitValue(val, this.validMultipleType ? `multiple-${type}` : type); } }, - handleClear(evt) { - evt.stopPropagation(); + clear() { this.emitValue(this.range ? [null, null] : null); this.$emit('clear'); }, + handleClear(evt) { + evt.stopPropagation(); + this.clear(); + }, handleConfirmDate() { const value = this.emitValue(this.currentValue); this.$emit('confirm', value); @@ -378,7 +381,7 @@ export default { const text = this.userInput.trim(); this.userInput = null; if (text === '') { - this.handleClear(); + this.clear(); return; } let date;