javascript - $(...)甘特图不是函数
问题描述
嘿,我正面临一个问题,我想在我的 Angular 项目中显示甘特图,所以我正在使用 .chart jquery.gantt 插件。
我在 angular.json 中添加了脚本,如下所示:
"scripts": [
"node_modules/jquery/dist/jquery.min.js" ,
"node_modules/popper.js/dist/umd/popper.min.js" ,
"node_modules/bootstrap/dist/js/bootstrap.min.js" ,
"src/assets/js/jquery.fn.gantt.min.js"
添加此代码以显示图表后:
ngOnInit(): void {
($(".chart_div") as any).gantt({
source: this.myData ,
scale: "weeks",
minScale: "weeks",
maxScale: "months",
onItemClick: function(data:any) {
alert("Item clicked - show some details");
},
onAddClick: function(dt:any, rowId:any) {
alert("Empty space clicked - add an item!");
},
onRender: function() {
console.log("chart rendered");
}
});
}
但我在控制台收到此错误:错误类型错误:jquery__WEBPACK_IMPORTED_MODULE_0__(...).gantt is not a function
请问有什么解决办法吗?
解决方案
推荐阅读
- c# - 如何使用 Selenium 和 C# 单击此特定元素
- typescript - 在 Oclif CLI 中包含以空格分隔的参数
- javascript - 添加自定义 fa-icons 添加到 JsTree
- php - 如何在 PHP 中将文件分组为一定大小的组
- java - 如何在java中修剪字符串目录
- mysql - 仅对一列使用 WHERE 子句
- java - 将 Mono 与 Flux 相结合
- swift - 为什么一个对象没有被解码?
- reactjs - 如何在 React Context API 挂钩中访问多个上下文的调度方法?
- swift - 无法使用 SwiftUI 重新创建 Apple 的示例