Skip to content

Commit

Permalink
Fixed #1581 - input mask - mask affecting dirty state v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Sep 22, 2021
1 parent 2306273 commit 5fb9bad
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/inputmask/InputMask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ export default {
let val = this.unmask ? this.getUnmaskedValue() : e.target.value;
this.$emit('input', (this.defaultBuffer !== val) ? val : '');
},
updateValue() {
updateValue(updateModel = true) {
if (this.$el) {
if (this.value == null) {
this.$el.value = '';
this.$emit('input', '');
updateModel && this.$emit('input', '');
}
else {
this.$el.value = this.value;
Expand All @@ -254,8 +254,10 @@ export default {
this.writeBuffer();
this.checkVal();
let val = this.unmask ? this.getUnmaskedValue() : this.$el.value;
this.$emit('input', (this.defaultBuffer !== val) ? val : '');
if (updateModel) {
let val = this.unmask ? this.getUnmaskedValue() : this.$el.value;
this.$emit('update:modelValue', (this.defaultBuffer !== val) ? val : '');
}
}
}, 10);
}
Expand Down Expand Up @@ -315,7 +317,7 @@ export default {
}
}
this.defaultBuffer = this.buffer.join('');
this.updateValue();
this.updateValue(false);
},
updated() {
if (this.isValueUpdated()) {
Expand Down

0 comments on commit 5fb9bad

Please sign in to comment.