wangEditor全屏插件在vue中怎么使用

如题,还是技术小白,真不知道该怎么合适的引入,请教教!
这个插件在vue中应该怎么写?
图片描述

阅读 4.1k
1 个回答

最近项目中刚用到

import Editor from 'wangeditor'

export default {
    methods: {
        initEditor() {
            var editor = new Editor('#editor')
            // editor.customConfig.uploadImgShowBase64 = true
            // editor.customConfig.uploadImgServer = '/upload'
            editor.customConfig.uploadImgServer = '/upload';
            editor.customConfig.uploadFileName = 'uploadfile';
            editor.customConfig.uploadImgHooks = {
                customInsert: function (insertImg, result, editor) {
                    var url = result.url
                    insertImg(url)
                }
            }
            editor.customConfig.customAlert = (info) => {
                this.$Notice.info({title: info})
            }
            editor.customConfig.onchange = (html) => {
                this.form.content = html
            }
            editor.create()
        }
    },
    mounted() {
        this.initEditor()
    }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进