From c8575cd0160172a036022c107712b58d24fc1d71 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Sat, 4 Jul 2020 09:41:47 +0800 Subject: [PATCH] fix: resolve images issue --- src/components/codeMirror/header.vue | 8 +++++--- src/store/index.js | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/codeMirror/header.vue b/src/components/codeMirror/header.vue index a240c03..2652ea7 100644 --- a/src/components/codeMirror/header.vue +++ b/src/components/codeMirror/header.vue @@ -174,10 +174,10 @@ export default { copy(e) { this.$emit('startCopy'); setTimeout(() => { + let clipboardDiv = document.getElementById('output'); solveWeChatImage(); fixCodeWhiteSpace(); - this.setOutput(solveHtml()); - let clipboardDiv = document.getElementById('output'); + this.setHtml(solveHtml()); clipboardDiv.focus(); window.getSelection().removeAllRanges(); @@ -189,6 +189,8 @@ export default { document.execCommand('copy'); window.getSelection().removeAllRanges() fixCodeWhiteSpace('normal'); + + clipboardDiv.innerHTML = this.output; // 输出提示 this.$notify({ showClose: true, @@ -251,7 +253,7 @@ export default { document.body.removeChild(downLink) }, ...mapMutations(['clearEditorToDefault','setCurrentColor', 'setCiteStatus', 'themeChanged', - 'setOutput', 'setCurrentFont', 'setCurrentSize', 'setCssEditorValue', 'setWxRendererOptions']) + 'setHtml', 'setCurrentFont', 'setCurrentSize', 'setCssEditorValue', 'setWxRendererOptions']) }, mounted() { this.selectFont = this.currentFont; diff --git a/src/store/index.js b/src/store/index.js index 71669f2..0e9876e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -16,6 +16,7 @@ Vue.use(Vuex) const state = { wxRenderer: null, output: '', + html: '', editor: null, cssEditor: null, currentFont: '', @@ -25,8 +26,8 @@ const state = { nightMode: false }; const mutations = { - setOutput(state, data) { - state.output = data; + setHtmL(state, data) { + state.html = data; }, setEditorValue(state, data) { state.editor.setValue(data)