From f55d98beb671cd2082ce0fad90000d8fde6087c1 Mon Sep 17 00:00:00 2001 From: Laxmikant Dange <5583697+dlinx@users.noreply.github.com> Date: Thu, 16 May 2019 14:34:09 +0900 Subject: [PATCH] Avoiding change loop Avoiding change loop if the value changes from jsoneditor. --- src/components/VJsoneditor/VJsoneditor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/VJsoneditor/VJsoneditor.js b/src/components/VJsoneditor/VJsoneditor.js index c96cb4b..0ec58b7 100644 --- a/src/components/VJsoneditor/VJsoneditor.js +++ b/src/components/VJsoneditor/VJsoneditor.js @@ -29,11 +29,14 @@ export default { data() { return { jsoneditor: null, + isInternalTrigger: false }; }, watch: { value(value) { - this.jsoneditor.set(value); + if(!this.isInternalTrigger) { + this.jsoneditor.set(value); + } }, }, methods: { @@ -59,6 +62,7 @@ export default { try { const value = this.jsoneditor.get(); this.$emit('input', value); + this.isInternalTrigger = true; // eslint-disable-next-line } catch (e) { } },