From 053a266a314c28eb08b90fbd6ceace82c82ef943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 1 Mar 2021 21:04:25 +0100 Subject: [PATCH] fix updating props, fix #181 --- packages/vue-3/src/VueRenderer.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/vue-3/src/VueRenderer.ts b/packages/vue-3/src/VueRenderer.ts index dc1285ea..3d6ead9e 100644 --- a/packages/vue-3/src/VueRenderer.ts +++ b/packages/vue-3/src/VueRenderer.ts @@ -1,4 +1,4 @@ -import { ref, markRaw, Component } from 'vue' +import { reactive, markRaw, Component } from 'vue' import { Editor } from './Editor' export interface VueRendererOptions { @@ -26,7 +26,7 @@ export class VueRenderer { this.component = markRaw(component) this.teleportElement = document.createElement('div') this.element = this.teleportElement - this.props = ref(props) + this.props = reactive(props) this.editor.vueRenderers.set(this.id, this) if (this.editor.contentComponent) { @@ -40,7 +40,11 @@ export class VueRenderer { } updateProps(props: { [key: string]: any } = {}) { - this.props.value = props + Object + .entries(props) + .forEach(([key, value]) => { + this.props[key] = value + }) } destroy() {