parent
b5ed379148
commit
9c6e199097
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,47 @@ |
||||
<template> |
||||
<div ref="divRef" style="height: calc(100% - 50px)"/> |
||||
</template> |
||||
<script> |
||||
import {AiEditor} from "aieditor"; |
||||
import "aieditor/dist/style.css" |
||||
|
||||
export default { |
||||
props: { |
||||
content: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
aiEditor: undefined, |
||||
} |
||||
}, |
||||
watch: { |
||||
content: { |
||||
handler(newVal, oldVal) { |
||||
if(newVal){ |
||||
this.aiEditor.setMarkdownContent(newVal) |
||||
} |
||||
}, |
||||
immediate: true |
||||
} |
||||
}, |
||||
beforeDestroy() { |
||||
this.aiEditor.destroy(); |
||||
}, |
||||
mounted() { |
||||
this.aiEditor = new AiEditor({ |
||||
element: this.$refs.divRef, |
||||
placeholder: "正在生成内容...", |
||||
textSelectionBubbleMenu: { |
||||
enable: true, |
||||
items: ["Bold", "Italic", "Underline", "Strike", "code", "comment"], |
||||
}, |
||||
}) |
||||
} |
||||
} |
||||
</script> |
||||
<style> |
||||
|
||||
</style> |
Loading…
Reference in new issue