如何将Chart.js添加到Moodle中的自定义插件中?
我正在创建Moodle中的自定义插件,并且我成功地集成了 Chart.js.js 。当缓存被禁用时,它可以在我的开发环境中完美工作。但是,当我打开缓存时,请在控制台中出现以下错误。
> amd/build/mql.min.js 。
以下是我的代码。
requirejs.config({
paths: {
"chartjs": "https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min"
}
});
define(
[
'jquery',
'core/str',
'core/ajax',
'core/templates',
'jqueryui',
'core/modal_factory',
'core/modal_events',
'chartjs'
],
function (
$,
Str,
ajax,
templates,
jqui,
ModalFactory,
ModalEvents,
Chart
){});
我在做什么错?我该如何解决?
I am creating a custom plugin in Moodle and I have successfully integrated Chart.js. It works perfectly in my development environment when the cache is disabled. But when I turn on my cache, the below error appears in the console.
local_mql is my custom plugin and the JavaScript file is added under amd/src/mql.js and the minified version is under amd/build/mql.min.js.
Below is my code.
requirejs.config({
paths: {
"chartjs": "https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min"
}
});
define(
[
'jquery',
'core/str',
'core/ajax',
'core/templates',
'jqueryui',
'core/modal_factory',
'core/modal_events',
'chartjs'
],
function (
$,
Str,
ajax,
templates,
jqui,
ModalFactory,
ModalEvents,
Chart
){});
What am I doing wrong? And how do I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
看来您的道路是错误的。
您缺少文件扩展名。
Use:
It seems your path is wrong.
You are missing the file extension.