From e68bda4ab6bbc05a37ad49f6fe1f81d517e91a12 Mon Sep 17 00:00:00 2001 From: JimQing Date: Fri, 1 May 2020 22:35:39 +0800 Subject: [PATCH] bug fix --- package.json | 1 + src/components/CodemirrorEditor.vue | 45 +++++++++++++++++++---------- src/store/index.js | 6 ++-- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 7111dce..985eaa8 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "babel-eslint": "^10.0.3", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", + "less-loader": "^6.0.0", "node-sass": "^4.12.0", "sass-loader": "^8.0.0", "vue-template-compiler": "^2.6.10" diff --git a/src/components/CodemirrorEditor.vue b/src/components/CodemirrorEditor.vue index bde61bf..b283473 100644 --- a/src/components/CodemirrorEditor.vue +++ b/src/components/CodemirrorEditor.vue @@ -3,28 +3,28 @@ - - +   - +   - +   - +   - + {{ font.label }} @@ -33,7 +33,7 @@ - + {{ size.label }} {{ size.desc }} @@ -41,7 +41,7 @@ - + {{ color.label }} {{ color.hex }} @@ -49,11 +49,10 @@ - + -    - + @@ -167,6 +166,9 @@ dialogFormVisible: false, timeout: null, source: '', + selectFont: '', + selectSize: '', + selectColor: '', status: '1' } }, @@ -192,6 +194,9 @@ this.initCssEditor() this.editorRefresh() }) + this.selectFont = this.currentFont + this.selectSize = this.currentSize + this.selectColor = this.currentColor }, methods: { initEditor() { @@ -410,14 +415,14 @@ this.editor.focus() }) }, - fontChanged (fonts) { + fontChanged(fonts) { this.setWxRendererOptions({ fonts: fonts }) this.setCurrentFont(fonts); this.editorRefresh() }, - sizeChanged (size) { + sizeChanged(size) { let theme = setFontSize(size.replace('px', '')) theme = setColorWithCustomTemplate(theme, this.currentColor) this.setWxRendererOptions({ @@ -427,7 +432,7 @@ this.setCurrentSize(size); this.editorRefresh() }, - colorChanged (color) { + colorChanged(color) { let theme = setFontSize(this.currentSize.replace('px', '')) theme = setColorWithCustomTemplate(theme, color) this.setWxRendererOptions({ @@ -467,6 +472,14 @@ } - diff --git a/src/store/index.js b/src/store/index.js index 8689f0a..bb88250 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,9 +18,9 @@ const state = { editor: null, cssEditor: null, html: '', - currentFont: {}, - currentSize: {}, - currentColor: {} + currentFont: '', + currentSize: '', + currentColor: '' }; const mutations = { setEditorValue(state, data) {