简体   繁体   English

利用ES6导入的jQuery插件

[英]Utilise jQuery plugin with ES6 import

I've installed the jquery plugin summernote using npm and it's within my node_modules directory. 我已经使用npm安装了jquery插件summernote ,它位于我的node_modules目录中。

I'm now trying to utilise the summernote function in much the same way as I was before when I was just loading the scripts within the html. 我现在正在尝试使用summernote函数,就像我刚刚在html中加载脚本时一样。

import { summernote } from 'summernote';

export default function () {
    const summernote = $('.editor');
    summernote.summernote();
}

I can't get past the above code throwing summernote.summernote is not a function 我无法通过上面的代码抛出summernote.summernote is not a function

This module doesn't export anything useful (like it should be expected from jQuery plugin package). 这个模块不会导出任何有用的东西 (就像从jQuery插件包中预期的那样)。

Imported summernote isn't used, and unused imported member makes an import a noop. 不使用导入的summernote ,未使用的导入成员导入noop。

It should be 它应该是

import 'summernote';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM