我正在尝试使用名为 dataTables.js
的插件运行或启动脚本.我已经设法使用 ES6
导入库导入语句以及 jquery
依赖。当我尝试运行或启动插件时,我收到如下所示的错误
jQuery.Deferred exception: (0 , _jquery.default)(...).DataTable is not a function TypeError: (0 , _jquery.default)(...).DataTable is not a function
at HTMLDocument.eval (https://juwto.csb.app/src/index.js:13:37)
at j (https://juwto.csb.app/src/jquery.js:1977:29)
at k (https://juwto.csb.app/src/jquery.js:1983:19)
沙盒链接 - https://codesandbox.io/s/gracious-chaplygin-juwto?file=/index.html
即使我设法正确导入库,我似乎也找不到合适的解决方案或答案
import $ from "./jquery";
import _dt from "./datatables";
$(document).ready(function() {
$("#table").DataTable({
paging: false,
bFilter: false,
bInfo: false
});
});
最佳答案
假设路径正确,尝试像这样导入数据表:import "./datatables.net";
关于javascript - 尝试运行或启动 dataTables.js 时收到 TypeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62127077/