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 = ` -