如何在 ember 中包含图表 js 注释?
How to include chart js annotations in ember?
我正在尝试在 ember 的项目中包含此注释,这是插件 https://www.npmjs.com/package/chartjs-plugin-annotation 的 link。
我试过了
npm i chartjs-plugin-annotation
但仍然没有运气,
我也试过了
npm i chartjs-plugin-annotation --save
还有其他方法可以在 ember 中包含此插件吗?
您可以将其作为 bower
依赖项包含在 bower install
命令中。
将其包含到项目中后,在ember-cli-build.js
文件中,使用app.import
将其添加到构建中,如下所示(请检查路径):
app.import('bower_components\chartjs-plugin-annotation\chartjs-plugin-annotation.min.js');
如果您不想使用 bower
而您更喜欢 npm
,请查看西兰花家族。路有点远
添加 npm package
ember install ember-auto-import
ember-cli-build.js
/* eslint-env node */
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
let app = new EmberApp(defaults, {
autoImport: {
alias: {
'chartjs-plugin-datalabels': 'chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.js',
},
}
});
return app.toTree();
};
在组件中导入-name.js
import 'chartjs-plugin-datalabels'
我正在尝试在 ember 的项目中包含此注释,这是插件 https://www.npmjs.com/package/chartjs-plugin-annotation 的 link。 我试过了
npm i chartjs-plugin-annotation
但仍然没有运气, 我也试过了
npm i chartjs-plugin-annotation --save
还有其他方法可以在 ember 中包含此插件吗?
您可以将其作为 bower
依赖项包含在 bower install
命令中。
将其包含到项目中后,在ember-cli-build.js
文件中,使用app.import
将其添加到构建中,如下所示(请检查路径):
app.import('bower_components\chartjs-plugin-annotation\chartjs-plugin-annotation.min.js');
如果您不想使用 bower
而您更喜欢 npm
,请查看西兰花家族。路有点远
添加 npm package
ember install ember-auto-import
ember-cli-build.js
/* eslint-env node */
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
let app = new EmberApp(defaults, {
autoImport: {
alias: {
'chartjs-plugin-datalabels': 'chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.js',
},
}
});
return app.toTree();
};
在组件中导入-name.js
import 'chartjs-plugin-datalabels'