mavon-editor引入开发markdown编辑器

在这里插入图片描述
文档地址

安装

npm install mavon-editor --save

在组件引入,也可在全局引入

import Vue from "vue";
import mavonEditor from "mavon-editor";
import "mavon-editor/dist/css/index.css";
Vue.use(mavonEditor);

完整代码

<template>
  <div class="box">
    <mavon-editor v-model="content" @change="changeCtx"></mavon-editor>
  </div>
</template>

<script>
import Vue from "vue";
import mavonEditor from "mavon-editor";
import "mavon-editor/dist/css/index.css";
Vue.use(mavonEditor);
export default {
  data() {
    return {
      content: "",
    };
  },
  mounted() {},
  methods: {
    changeCtx(e) {
      console.log(e);
    },
  },
};
</script>

<style lang="less" scoped>
</style>
©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页