浏览代码

fix: 修复 Editor 切换 readonly 时只读状态无效的 bug

朱桂志 3 月之前
父节点
当前提交
5bc3c9090b
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/components/Editor/src/Editor.vue

+ 10 - 0
src/components/Editor/src/Editor.vue

@@ -58,6 +58,16 @@ watch(
     emit('update:modelValue', val)
   }
 )
+watch(
+  () => props.readonly,
+  (val) => {
+    if (val) {
+      editorRef.value?.disable()
+    } else {
+      editorRef.value?.enable()
+    }
+  }
+)
 
 const handleCreated = (editor: IDomEditor) => {
   editorRef.value = editor