admin管理员组文章数量:1394089
I've installed the jquery plugin summernote using npm and it's within my node_modules directory.
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.
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
I've installed the jquery plugin summernote using npm and it's within my node_modules directory.
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.
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
- I'm not sure what you're suggesting – Luke Vincent Commented Apr 26, 2017 at 17:21
-
1
import { summernote } from 'summernote'; declare var $;
is not valid syntax – Luke Vincent Commented Apr 26, 2017 at 17:25 - Which bundler are you using? – Prashant Commented Apr 26, 2017 at 17:27
-
1
A jQuery plugin that does install a method to the global jQuery prototype would not export anything. Are you sure you did import jQuery and
$
refers to jQuery?import $ from 'jquery'; import 'summernote';
should do. – Bergi Commented Apr 26, 2017 at 17:27 - That seems to have worked although jquery seemed to be working fine. It's only when I tried to access a plugin through a jquery obj would I get an error. – Luke Vincent Commented Apr 26, 2017 at 17:31
1 Answer
Reset to default 5This module doesn't export anything useful (like it should be expected from jQuery plugin package).
Imported summernote
isn't used, and unused imported member makes an import a noop.
It should be
import 'summernote';
本文标签: javascriptUtilise jQuery plugin with ES6 importStack Overflow
版权声明:本文标题:javascript - Utilise jQuery plugin with ES6 import - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744702277a2620630.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论