当前位置: 首页 > 工具软件 > Vditor > 使用案例 >

Markdown插件vditor

南门祯
2023-12-01

Markdown插件vditor

在Vue2中安装vditor,

npm install vditor --save

使用vditor代码如下,

<template>
  <div id="vditor" name="description"></div>
</template>

<script>
import Vditor from "vditor";
import "vditor/src/assets/scss/index.scss";

export default {
  data() {
    return {
      contentEditor: "",
    };
  },
  mounted() {
    this.contentEditor = new Vditor("vditor", {
      height: 360,
      toolbarConfig: {
        pin: true,
      },
      cache: {
        enable: false,
      },
      after: () => {
        this.contentEditor.setValue("hello,Vditor");
      },
    });
  },
};
</script>
 类似资料: