mavon-editor引入开发markdown编辑器

2020-10-29 10:29:32 浏览数 (1)

文档地址

安装

代码语言:javascript复制
npm install mavon-editor --save

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

代码语言:javascript复制
import Vue from "vue";
import mavonEditor from "mavon-editor";
import "mavon-editor/dist/css/index.css";
Vue.use(mavonEditor);

完整代码

代码语言:javascript复制
<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>

0 人点赞