From a8b15d11d647fbe2f13b1fa7f63a8610867acfe4 Mon Sep 17 00:00:00 2001 From: fofolee Date: Sun, 3 Apr 2022 11:41:51 +0800 Subject: [PATCH] =?UTF-8?q?monaco=20=E6=9A=97=E9=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MonocaEditor.vue | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/MonocaEditor.vue b/src/components/MonocaEditor.vue index cc0c3b8..1f14137 100644 --- a/src/components/MonocaEditor.vue +++ b/src/components/MonocaEditor.vue @@ -28,19 +28,21 @@ export default { }, methods: { initEditor() { + let monacoEditorPreferences = { + value: "", + language: "javascript", + automaticLayout: true, + foldingStrategy: "indentation", + autoClosingBrackets: true, + tabSize: 2, + minimap: { + enabled: false, + }, + }; + if (this.$q.dark.isActive) monacoEditorPreferences.theme = "vs-dark"; this.editor = monaco.editor.create( document.getElementById("monocaEditor"), - { - value: "", - language: "javascript", - automaticLayout: true, - foldingStrategy: "indentation", - autoClosingBrackets: true, - tabSize: 2, - minimap: { - enabled: false, - }, - } + monacoEditorPreferences ); this.loadTypes(); this.registerLanguage();