From 035f02075f1f652c676f80519fb621da180fb2dc Mon Sep 17 00:00:00 2001 From: NeleR Date: Fri, 14 Dec 2018 13:04:01 +0100 Subject: [PATCH] Handle external changes to value 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. #19 --- src/Cleave.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Cleave.vue b/src/Cleave.vue index a024492..60da19e 100644 --- a/src/Cleave.vue +++ b/src/Cleave.vue @@ -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)); } },