如何在 Svelte/Sapper 应用程序中包含 JQuery? [英] How to Include JQuery in a Svelte/Sapper Application?
问题描述
有许多组件仍然需要我需要使用的 JQuery(不幸的是).
There are many components that still require JQuery that I need to use (unfortunately).
在 Svelte/Sapper 中执行此操作的最佳方法是什么?我应该使用 ES6 导入,修改汇总,还是最好的方法?
What is the best way to do this in Svelte/Sapper? Should I use ES6 Imports, modify rollup, or what is the best approach?
例如,我需要包含来自 DevExpress 或 Kendo UI 的数据透视表、网格、调度程序等.
For example, I need to include a pivot table, grid, scheduler, etc from DevExpress or Kendo UI.
我可以在 template.html 文件中全局引入 JQuery 并使其工作,但我确定这不是最好的方法.
I can pull in JQuery globally in the template.html file and get things to work, but I'm sure this is not the best way.
推荐答案
将其作为 包含在 template.html 中是可以的.或者,做
Including it as a <script>
in template.html is fine. Alternatively, do
import jQuery from 'jquery';
在使用它的任何组件或模块中.
in any components or modules that use it.
这篇关于如何在 Svelte/Sapper 应用程序中包含 JQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!