vue2.0项目使用wangEditor富文本编辑器

版权声明: https://blog.csdn.net/xiasohuai/article/details/84345097

首先

npm install wangeditor 

然后,直接写就行,也无需引入css样式 

<template>
  <div class="detailPage">
    <div id="editor">
        <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
    </div>
  </div>
</template>

<script type="text/javascript">
    export default{
      mounted(){
        var E = require('wangeditor')      
        var editor = new E('#editor')
        editor.customConfig.uploadImgShowBase64 = true//img图片转成base64格式,需要的话写,不需要不写
        editor.create()
      }
    }
</script>

效果图:

猜你喜欢

转载自blog.csdn.net/xiasohuai/article/details/84345097