From 1909f2d902525c8dd0c60803a3925700f9bcfb13 Mon Sep 17 00:00:00 2001 From: NeleR Date: Mon, 10 Dec 2018 10:26:38 +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. --- src/Cleave.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Cleave.vue b/src/Cleave.vue index a024492..abaae20 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(newValue); } },