Loading

Vue使用Vditor编辑器

目录

1、安装

2、使用

3、获取编辑内容


1、安装

npm install vditor --save

2、使用

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

3、获取编辑内容

this.editor.getValue();     //获取 Markdown 内容
this.editor.getHTML();      //获取 HTML 内容

posted @ 2020-11-20 09:45  Roc-xb  阅读(110)  评论(0)    收藏  举报

易微帮源码


易微帮官网