From 4d9e843a4c167b1208a33581e1b474dcf7d50dbe Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 27 Apr 2023 11:54:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E5=8F=98=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/code-editor.vue | 5 ++++- src/pages/playground/views/preview.vue | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/code-editor.vue b/src/components/code-editor.vue index 84209bf..06f3985 100644 --- a/src/components/code-editor.vue +++ b/src/components/code-editor.vue @@ -36,6 +36,8 @@ export default { mounted() { let lang = this.lang + let firstLoad = true + this.$last = this.code this.$view = new EditorView({ @@ -52,8 +54,9 @@ export default { // 监听代码变化 EditorView.updateListener.of(v => { let value = v.state.doc.toString() - if (!this.$last || value.trim() === this.$last) { + if (firstLoad || value.trim() === this.$last) { this.$last = value.trim() + firstLoad = false return } this.$last = value.trim() diff --git a/src/pages/playground/views/preview.vue b/src/pages/playground/views/preview.vue index 67f107b..6b63a24 100644 --- a/src/pages/playground/views/preview.vue +++ b/src/pages/playground/views/preview.vue @@ -66,7 +66,7 @@ export default { // _time / 2000 * 100 % this.progress = ~~(_time / 10) - if (pending && _time > 1000) { + if (pending && _time >= 1000) { this.progress = 0 let doc = this.$refs.view.contentDocument From 8c3427395c1d996c9916813395e6befcd9522fa5 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 27 Apr 2023 11:57:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E5=87=BA=E7=8E=B0undefined=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/playground/app.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/playground/app.vue b/src/pages/playground/app.vue index aa0fa67..7ed4518 100644 --- a/src/pages/playground/app.vue +++ b/src/pages/playground/app.vue @@ -55,9 +55,9 @@ export default { } catch (e) {} } - this.html = code.html - this.js = code.js - this.css = code.css + this.html = code.html || '' + this.js = code.js || '' + this.css = code.css || '' this.updatePreview() } this.$needUpdate = true