weixin_41359495
H_Franky
采纳率100%
2021-02-24 23:44

vue-quill-editor引入图片缩放插件报错

报错:TypeError: Cannot read property 'imports' of undefined

我的vue是

网上的办法在根目录创建了vue-config.js文件写了如下代码也不行,还有什么办法?拖拽那个好像没报错,但是拖拽不了,图片还是在原来的位置,还有什么解决办法?

我的配置:

import { quillEditor, Quill } from 'vue-quill-editor';
import { addQuillTitle } from '../../assets/js/quill-title.js'; // 引入鼠标移入标题显示说明
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';

// import Quill from "quill";
import { ImageResize } from "quill-image-resize-module"; // 引用
import { ImageDrop } from "quill-image-drop-module";
Quill.register("modules/imageDrop", ImageDrop);
Quill.register("modules/imageResize", ImageResize); // 注册

data() {
        return {
            editorOption: { //  富文本编辑器配置
                placeholder: "请开始发挥您的文采!",
                theme: "snow", // 主题
                modules: {
                    imageDrop: true,
                    imageResize: {
                        displayStyles: {
                            backgroundColor: "black",
                            border: "none",
                            color: "white"
                        },
                        modules: ["Resize", "DisplaySize", "Toolbar"]
                    },
                     .
                     .
                     .
var webpack = require('webpack');
module.exports = {
    configureWebpack: {
        plugins: [
            new webpack.ProvidePlugin({
                'window.Quill': 'quill/dist/quill.js',
                'Quill': 'quill/dist/quill.js'
            }),
        ]
    }
}

// ——————————————————————————————————————————————————————————————————————
const webpack = require('webpack')
module.exports = {
    chainWebpack: config => {
        config.plugin('provide').use(webpack.ProvidePlugin, [{
            'window.Quill': 'quill'
        }])
    }
}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答