From 40aee7a57537f7576912c68ba262f9abef88d6df Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 27 May 2020 13:41:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MonacoEditorVue/index.js | 11 +- src/components/preview/SimTextPreview.vue | 168 +++++++++++++++++++--- src/icons/svg/fullscreen.svg | 1 + src/icons/svg/normalscreen.svg | 1 + src/utils/directives.js | 17 ++- 5 files changed, 166 insertions(+), 32 deletions(-) create mode 100644 src/icons/svg/fullscreen.svg create mode 100644 src/icons/svg/normalscreen.svg diff --git a/src/components/MonacoEditorVue/index.js b/src/components/MonacoEditorVue/index.js index 270df6b..c6c645e 100644 --- a/src/components/MonacoEditorVue/index.js +++ b/src/components/MonacoEditorVue/index.js @@ -8,8 +8,10 @@ export default { name: 'MonacoEditor', props: { diffEditor: { type: Boolean, default: false }, //是否使用diff模式 - width: {type: [String, Number], default: '100%'}, - height: {type: [String, Number], default: '100%'}, + // width: {type: [String, Number], default: '100%'}, + // height: {type: [String, Number], default: '100%'}, + width: Number, + height: Number, original: String, //只有在diff模式下有效 value: String, language: {type: String, default: 'javascript'}, @@ -57,8 +59,8 @@ export default { computed: { style() { return { - width: !/^\d+$/.test(this.width) ? this.width : `${this.width}px`, - height: !/^\d+$/.test(this.height) ? this.height : `${this.height}px` + width: `${this.width}px`, + height: `${this.height}px` } } }, @@ -89,7 +91,6 @@ export default { }); this.diffEditor && this._setModel(this.value, this.original); this._editorMounted(this.editor); //编辑器初始化后 - console.log(this.editor.getOptions()) }, _getEditor() { diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 7364446..1043553 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -1,26 +1,34 @@