From 1b84a0f66b158ab4df3f9de630e1f1cfd980ea59 Mon Sep 17 00:00:00 2001 From: "X.Mo" Date: Sat, 30 Dec 2023 10:59:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20ma-codeEditor=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ma-codeEditor/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/ma-codeEditor/index.vue b/src/components/ma-codeEditor/index.vue index 4609bd3c..cf268410 100644 --- a/src/components/ma-codeEditor/index.vue +++ b/src/components/ma-codeEditor/index.vue @@ -30,6 +30,10 @@ const props = defineProps({ type: [String, Object, Array], default: () => '' }, + defaultModelValue: { + type: String, + default: '', + }, valueType: { type: String, default: 'value' @@ -82,10 +86,9 @@ const initEditorValue = () => { } else if (props.valueType === 'value' && props.modelValue._onWillDispose === undefined) { instance.setValue(formatJson(props.modelValue)) } else if (props.modelValue){ - console.log(props.modelValue) instance.setModel(toRaw(props.modelValue)) } else { - instance.setModel(monaco.editor.createModel('', props.language)) + instance.setModel(monaco.editor.createModel(props.defaultModelValue, props.language)) } }