目录
npm install vditor --save
<template>
<div id="vditor" name="description" ></div>
</template>
<script>
import Vditor from "vditor";
import "vditor/src/assets/scss/index.scss";
export default {
data(){
return{
editor:""
}
},
mounted(){
this.contentEditor = new Vditor("vditor",{
height:360,
toolbarConfig:{
pin:true
},
cache:{
enable:false
},
after:()=>{
this.editor.setValue("hello,Vditor")
}
})
}
}
</script>
this.editor.getValue(); //获取 Markdown 内容
this.editor.getHTML(); //获取 HTML 内容