UNPKG

simple-frame-unit

Version:

基于vue2 研发的与simple-data后端配合使用的组件

33 lines (29 loc) 844 B
import Vue from "vue"; import replaceUrl from "../EdRichText/replaceUrl" let Content = null export default { name: 'EdRichPreview', props: { value: {type: String, default: '',}, }, // 文章编辑相关配置 data() { return { editor: null, // 这里的 HTML 内容必须是 wangEditor 生成的(即 editor.getHtml() 返回的) HTML 格式,不可以自己随意写 defaultHtml: this.value, } }, render(h) { if (this.value !== "") { let dome = replaceUrl(this.value, this.$EdFrame.BASE_API, true) Content = Vue.extend({ template: `<div><template>${dome}</template></div>` }) return Content ? h(Content) : null } return h('span') }, methods: { }, }