From 41b415362cc8515b28632e55948891b43494d369 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sun, 8 Dec 2024 19:18:09 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20markdown=E7=9B=B4=E6=8E=A5v-model?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E5=80=BC=20=E4=BF=9D=E6=8C=81=E4=B8=8E?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E7=9A=84=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../effects/common-ui/src/components/markdown/editor.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/effects/common-ui/src/components/markdown/editor.vue b/packages/effects/common-ui/src/components/markdown/editor.vue index 8a64c67c..47ffbe04 100644 --- a/packages/effects/common-ui/src/components/markdown/editor.vue +++ b/packages/effects/common-ui/src/components/markdown/editor.vue @@ -82,6 +82,13 @@ const content = defineModel('value', { type: String, default: '', }); +/** + * 为了保持外部直接(v-model)与编辑器内部的同步 + * 注意: 下面的input事件也会触发watch + */ +watch(content, (value) => { + vditorInstance.value?.setValue(value); +}); // 监听禁用 function changeDisabled(disabled: boolean) {