import WangEditor from 'wangeditor'
setup() {
const editor = ref()
const content = reactive({
html: '',
text: '',
})
let instance
onMounted(() => {
instance = new WangEditor(editor.value)
Object.assign(instance.config, {
onchange() {
content.html = instance.txt.html()
},
})
instance.create()
})
onBeforeUnmount(() => {
instance.destroy()
instance = null
})
return {
editor,
content,
}
},
在vue3中使用富文本编辑器WangEditor
最新推荐文章于 2024-05-29 16:06:14 发布