浏览代码

fix(codeeditor): empty value set failed.fixed:#659

无木 3 年之前
父节点
当前提交
ba2bebb406
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/components/CodeEditor/src/codemirror/CodeMirror.vue

+ 3 - 1
src/components/CodeEditor/src/codemirror/CodeMirror.vue

@@ -53,7 +53,9 @@
         async (v) => {
           await nextTick();
           const oldValue = editor?.getValue();
-          v && v !== oldValue && editor?.setValue(v);
+          if (v !== oldValue) {
+            editor?.setValue(v ? v : '');
+          }
         },
         { flush: 'post' }
       );