From 2055615e8efff28ed07285fc885f5ab0710729b7 Mon Sep 17 00:00:00 2001 From: bouc615 Date: Wed, 11 Dec 2019 15:50:04 +0800 Subject: [PATCH] fix: reset css editor --- assets/scripts/editor.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/scripts/editor.js b/assets/scripts/editor.js index a613f60..dcce2e9 100644 --- a/assets/scripts/editor.js +++ b/assets/scripts/editor.js @@ -198,12 +198,11 @@ let app = new Vue({ type: 'warning', center: true }).then(() => { - localStorage.removeItem('__editor_content'); - localStorage.removeItem('__css_content'); + localStorage.clear() this.setDefaultContent(); this.cssEditor.setValue(DEFAULT_CSS_CONTENT); this.editor.focus(); - this.refresh(); + this.cssChanged() }).catch(() => { this.editor.focus(); }); @@ -220,8 +219,12 @@ let app = new Vue({ localStorage.removeItem(name); } }, - customStyle() { + async customStyle() { this.showBox = !this.showBox; + let flag = await localStorage.getItem("__css_content") + if (!flag) { + this.cssEditor.setValue(DEFAULT_CSS_CONTENT); + } }, setDefaultContent() { axios({