From 9e142de3de9b400b0b36af6a35e3849388877d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89?= <814457906@qq.com> Date: Mon, 8 Apr 2024 10:58:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/components/wangEditor.vue | 45 +++++++++++++++---- src/views/system/specialDiseaseNode/index.vue | 13 +++--- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/views/system/components/wangEditor.vue b/src/views/system/components/wangEditor.vue index 339aded..a893fed 100644 --- a/src/views/system/components/wangEditor.vue +++ b/src/views/system/components/wangEditor.vue @@ -41,6 +41,7 @@ import { getToken } from "@/utils/auth"; var that export default ({ + props: ['nodeContent'], components: { Editor, Toolbar }, name: 'wangEditor', data() { @@ -86,6 +87,7 @@ export default ({ }, methods: { emit() { + console.log() this.$emit("on-nodeContent", { nodeContent: this.html }); }, panelchange(item) { @@ -124,7 +126,7 @@ export default ({ link: '', fileName: this.addnode.fileName, fileSpan: this.addnode.fileSpan, - children: [{ text: ' ' }], // void 元素必须有一个 children ,其中只有一个空字符串,重要!!! + children: [{ text: '' }], // void 元素必须有一个 children ,其中只有一个空字符串,重要!!! } this.editor.insertNode(resume) this.addnode = { @@ -149,7 +151,7 @@ export default ({ link: '', fileName: this.addnode.fileName, fileSpan: this.addnode.fileSpan, - children: [{ text: ' ' }], // void 元素必须有一个 children ,其中只有一个空字符串,重要!!! + children: [{ text: '' }], // void 元素必须有一个 children ,其中只有一个空字符串,重要!!! } this.editor.insertNode(resume) this.addnode = { @@ -192,7 +194,15 @@ export default ({ this.labelshow = false }, }, + watch: { + nodeContent(newValue, oldValue) { + if (newValue) { + this.html = newValue; + } + } + }, mounted() { + this.html = this.nodeContent }, beforeDestroy() { const editor = this.editor @@ -279,7 +289,6 @@ function withAttachment(editor) { // JS 语法 const type = DomEditor.getNodeType(elem) if (type === 'attachment') return true // 针对 type: attachment ,设置为 inline if (type === 'attachmenttwo') return true // 针对 type: attachment ,设置为 inline - if (type === 'text') return true // 针对 type: attachment ,设置为 inline return isInline(elem) } newEditor.isVoid = elem => { @@ -464,8 +473,7 @@ function attachmentToHtml(elem, childrenHtml) { // JS 语法 // 获取附件元素的数据 const { link = '', fileName = '', fileSpan = '' } = elem // 生成 HTML 代码 - const html = ` -