首页 > 其他分享> > vue 引进quill-image-resize-module 报错 TypeError: Cannot read property 'imports' of undefined
vue 引进quill-image-resize-module 报错 TypeError: Cannot read property 'imports' of undefined
作者:互联网
vue 引进quill-image-resize-module 报错TypeError: Cannot read property 'imports' of undefined
at Object.eval (image-resize.min.js?f318:1)
at e (image-resize.min.js?f318:1)
at Object.eval (image-resize.min.js?f318:1)
解决办法:
1、在根目录下新建vue.config.js 文件 (不是在src 下)
var webpack = require('webpack'); module.exports = { // 在vue.config.js中configureWebpack中配置 // 要引入webpackconfigureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
2、mian.js
import VueQuillEditor from 'vue-quill-editor' import 'quill/dist/quill.core.css' import 'quill/dist/quill.snow.css' import 'quill/dist/quill.bubble.css' Vue.use(VueQuillEditor); 3、页面中 import { Quill } from 'vue-quill-editor' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize) 4、需要重新运行一下标签:vue,undefined,image,js,报错,resize,import,quill 来源: https://www.cnblogs.com/wihimi/p/14246911.html