1、安装

npm install vue-simplemde --save-dev

2、在项目的main.js中引入

import VueSimplemde from 'vue-simplemde'
import 'simplemde/dist/simplemde.min.css'
Vue.use(VueSimplemde)

3、在Vue组建中使用

<template>
    <div class="markdown">
        <markdown-editor v-model="content"></markdown-editor>
    </div>
</template>

<script>
    import markdownEditor from 'vue-simplemde/src/markdown-editor';
    export default {
        components: { markdownEditor },
        data() {
            return {
                content: '',
                configs: {}
            };
        }
    }
</script>

<style scoped>
  .markdown{
      width: 60%;
      margin: 0 auto;
  }
</style>

Logo

前往低代码交流专区

更多推荐