From 8dd06128c41f959c8040cdf1e995ab6b7cf69200 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 24 Apr 2020 09:44:04 +0300 Subject: [PATCH] Fixed #290 - InputMask somehow clears the initial value to empty string --- src/components/inputmask/InputMask.vue | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/inputmask/InputMask.vue b/src/components/inputmask/InputMask.vue index 0e7014b2c..f1c6d66f9 100644 --- a/src/components/inputmask/InputMask.vue +++ b/src/components/inputmask/InputMask.vue @@ -243,22 +243,23 @@ export default { if (this.$el) { if (this.value == null) { this.$el.value = ''; + this.$emit('input', ''); } else { this.$el.value = this.value; this.checkVal(); + + setTimeout(() => { + if (this.$el) { + this.writeBuffer(); + this.checkVal(); + + let val = this.unmask ? this.getUnmaskedValue() : this.$el.value; + this.$emit('input', (this.defaultBuffer !== val) ? val : ''); + } + }, 10); } - setTimeout(() => { - if(this.$el) { - this.writeBuffer(); - this.checkVal(); - - let val = this.unmask ? this.getUnmaskedValue() : this.$el.value; - this.$emit('input', (this.defaultBuffer !== val) ? val : ''); - } - }, 10); - this.focusText = this.$el.value; } } @@ -488,4 +489,4 @@ export default { }, } } - \ No newline at end of file +