javascript - 如何将 chart.js 3+ 导入 React 应用程序?
问题描述
我在将 chart.js 导入我的应用程序时遇到了问题,而在版本 2+ 中它很简单:
import Chartjs from 'chart.js';
现在这不再起作用了。
Attempted import error: 'chart.js' does not contain a default export (imported as 'Chartjs').
解决方案
我想你必须像这样导入它:
import { Chart } from 'chart.js';
更多信息请访问: https ://www.chartjs.org/docs/latest/getting-started/integration.html
推荐阅读
- firebase - 如何检查请求是否来自 Firebase 管理员并检查它是否在 Firestore 安全规则中得到验证?
- networking - Kubernetes 更改 Pod 地址
- java - 解析 JSON 并将对象添加到数组仅在第二次按下按钮时起作用?
- javascript - Vue.js 方法声明之间的区别
- git - 吉特 | 在提交时恢复未添加的文件
- angular - 如何删除 mat-grid-tile 之间的填充
- r - if (sjmisc::is_empty(x)) return(NULL) 出错:需要 TRUE/FALSE 的地方缺少值
- c# - 使用 .net core API 将 XML 文件下载到本地机器
- python - SymPy:求解线性方程组的超定系统
- r - 使用 RSelenium:找不到 Java