您当前的位置: 首页 >  ar

彭世瑜

暂无认证

  • 0浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Vue:MarkDown编辑器mavon-editor

彭世瑜 发布时间:2020-12-18 13:56:53 ,浏览量:0

文档:https://www.npmjs.com/package/mavon-editor

安装依赖

npm install mavon-editor --save

示例


  



/**
 * https://www.npmjs.com/package/mavon-editor
 * 
 * npm install mavon-editor --save
 */
import { mavonEditor } from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';

/**
 * 
 * 事件
 * save
 * change
 */
export default {
  name: '',

  props: [],

  components: {
    mavonEditor,
  },

  data() {
    return {
      
    };
  },

  computed: {},

  methods: {
    // 将图片上传到服务器,返回地址替换到md中
    async handleImgAdd(pos, file) {
      let form = new FormData();
      form.append('file', file);

      const res = await this.$Http.postUploadFile(form);
      console.log(res);
      this.$refs.md.$img2Url(pos, res.data.url);
    },
  },

  created() {},
};




在这里插入图片描述

参考 vue中使用markdown编辑器

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.2880s