vue+ wangEditor富文本编辑器加持
安装
npm install wangEditor --save
组件中调用
<template>
<div id="editor" ref="editor" style="text-align:left"></div>
</template>
<script>
import E from 'wangeditor'
export default {
mounted() {
var editor = new E(this.$refs.editor)
editor.customConfig.onchange = (html) => {
this.editorContent = html
}
editor.customConfig.zIndex = 1;
editor.customConfig.uploadImgServer = '/upload';
editor.create()
},
}
</script>
创建成功