From ae7a54dd7888c156141689a2f1a18c37ef663a69 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 27 Nov 2020 21:51:49 +0300 Subject: [PATCH] Refactor #714 --- src/components/inputmask/InputMask.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/inputmask/InputMask.vue b/src/components/inputmask/InputMask.vue index 640c203b5..e1c5072bb 100755 --- a/src/components/inputmask/InputMask.vue +++ b/src/components/inputmask/InputMask.vue @@ -414,6 +414,11 @@ export default { this.focusText = this.$el.value; } + }, + isValueUpdated() { + return this.unmask ? + (this.modelValue != this.getUnmaskedValue()) : + (this.defaultBuffer !== this.$el.value && this.$el.value !== this.modelValue); } }, mounted() { @@ -464,11 +469,9 @@ export default { this.defaultBuffer = this.buffer.join(''); this.updateValue(); }, - watch: { - value(newValue, oldValue) { - if (oldValue && oldValue !== newValue && this.$el.value !== newValue) { - this.updateValue(); - } + updated() { + if (this.isValueUpdated()) { + this.updateValue(); } }, computed: {