Error in v-on handler: "Error: 错误:初始化编辑器时候未传入任何参数,请查阅文档"
Error: 错误:初始化编辑器时候未传入任何参数,请查阅文档 at new Editor (wangEditor.js:4335) at
<el-dialog
@opened="showClick()"
@closed="hideClick()"
width="850px"
:visible.sync="dialogVisible"
:title="dialogType===0?'修改':'新增'"
>
<el-form :model="addlist" label-width="50px">
<el-form-item label="内容">
<div id="wangeditor">
<div ref="editorElem" style="text-align:left;"></div>
</div>
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="success" @click="confirmRole">确定</el-button>
<el-button @click="dialogVisible=false">取消</el-button>
</div>
</el-dialog>
<script>
import E from 'wangeditor'
export default {
data() {
return {
editor: '',
}
},
methods: {
showClick() {//这里是解决dialog弹出层初始化失败的问题
this.editor = new E(this.$refs.editorElem)
this.editor.customConfig.zIndex = 10
this.editor.customConfig.onchange = html => {
console.log('html', html)
}
this.editor.create()
},
hideClick() {//这里是解决富文本嵌套问题
this.$refs.editorElem.innerHTML = ''
this.editor = null
}
}
}