From b540010af589683ad9e6dfa9baac60d0614d7ac0 Mon Sep 17 00:00:00 2001 From: Spartak Date: Wed, 10 Jun 2020 13:42:17 +0300 Subject: [PATCH] added watchers to checnge options reactively --- demo/VueRoughNotation.vue | 37 +++++++++++++++++++++++++++++++++ src/components/RoughNotation.js | 10 +++++++++ 2 files changed, 47 insertions(+) diff --git a/demo/VueRoughNotation.vue b/demo/VueRoughNotation.vue index 0d76aa2..72a8c63 100644 --- a/demo/VueRoughNotation.vue +++ b/demo/VueRoughNotation.vue @@ -98,6 +98,23 @@ +
+
+

+ Reactive change +

+

+ Color, Stroke width, Padding will change reactively +

+
+
+

@@ -109,6 +126,12 @@ diff --git a/src/components/RoughNotation.js b/src/components/RoughNotation.js index 9ef17cc..5dc7248 100644 --- a/src/components/RoughNotation.js +++ b/src/components/RoughNotation.js @@ -94,6 +94,16 @@ export default (options) => ({ this.hide(); } }, { immediate: true }); + + this.$watch('color', (value) => { + this.annotation.color = value + }); + this.$watch('strokeWidth', (value) => { + this.annotation.strokeWidth = value + }); + this.$watch('padding', (value) => { + this.annotation.padding = value + }); }, beforeDestroy () {