Skip to content

Commit

Permalink
Handle external changes to value
Browse files Browse the repository at this point in the history
Sometimes the value of a field is initialised or calculated externally and thus filled in automatically, not by an input event. External changes of the value are now also passed to cleave to make sure they are masked properly.

vue-bulma#19
  • Loading branch information
NeleR authored Dec 14, 2018
1 parent 8b3126e commit 035f020
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Cleave.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export default {
this.cleave.destroy()
this.cleave = new Cleave(this.$el, val)
}
},
// watch the value to make sure external changes (not by input) are taken into account as well
value: function (newValue) {
this.cleave.setRawValue(value(newValue));
}
},
Expand Down

0 comments on commit 035f020

Please sign in to comment.