使用 wangeditor 时报错 Cannot set property ‘onchange' of undefined,如下图:

网上查资料发现,wangeditor “>=3.0.0“时会出现这个错误,当前是4.7.7版本,貌似是版本问题,用this.editor.customConfig = this.editor.customConfig ? this.editor.customConfig : this.editor.config; 兼容老版本。
如下:
mounted () {
this.editor = new E(this.$refs.editor)
this.editor.customConfig = this.editor.customConfig ? this.editor.customConfig : this.editor.config
this.editor.customConfig.onchange = (html) => {
this.editorContent = html
}
// this.editor.customConfig.uploadImgShowBase64 = true // 使用base64保存图片 上下两者不可同用
this.editor.customConfig.uploadImgServer = 'xxxxxxxx' // 上传图片到服务器
// 隐藏“网络图片”tab
this.editor.customConfig.showLinkImg = false
this.editor.create()
}
最后
以上就是矮小棒球最近收集整理的关于wangeditor富文本编辑器Cannot set property ‘onchange‘ of undefined的全部内容,更多相关wangeditor富文本编辑器Cannot内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复