Browse Source

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

无木 3 years ago
parent
commit
ba2bebb406
1 changed files with 3 additions and 1 deletions
  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) => {
         async (v) => {
           await nextTick();
           await nextTick();
           const oldValue = editor?.getValue();
           const oldValue = editor?.getValue();
-          v && v !== oldValue && editor?.setValue(v);
+          if (v !== oldValue) {
+            editor?.setValue(v ? v : '');
+          }
         },
         },
         { flush: 'post' }
         { flush: 'post' }
       );
       );