我想在aurelia项目中使用chart.js,但是我遇到了错误.如何将第三方节点包添加到aurelia应用程序?
我正在使用aurelia-cli,BTW
这就是我所做的
npm install --save chart.js
Run Code Online (Sandbox Code Playgroud)
在aurelia.json
我添加以下内容
"dependencies": [
...,
{
"name": "chart.js",
"path": "../node_modules/chart.js/dist",
"main": "Chart.min.js"
}
]
Run Code Online (Sandbox Code Playgroud)
在app.html
我然后添加线
<require from="chart.js"></require>
Run Code Online (Sandbox Code Playgroud)
但是,我得到错误:
vendor-bundle.js:1399 Unhandled rejection Error: Load timeout for modules: template-registry-entry!chart.html,text!chart.html
Run Code Online (Sandbox Code Playgroud)
我尝试了各种各样的事情,比如将图表注入 app.html
// DIDN'T WORK :-(
// app.js
import {inject} from 'aurelia-framework';
import {Chart} from 'chart.js';
export class App {
static inject() { return [Chart]};
constructor() {
this.message = 'Hello World!';
}
}
Run Code Online (Sandbox Code Playgroud)
然后,在app.html中,我添加了以下require语句
<require from="Chart"></require>
Run Code Online (Sandbox Code Playgroud)
你可以在这里查看一个工作示例.最初,我认为你必须使用该aurelia-chart
模块,但是,它很难使用,因此,我建议你只使用Chart.JS …
我正在使用Slim Framework 3来创建API.应用程序结构是:MVCP(模型,视图,控制器,提供程序).
是否可以使用Slim Dependency注入我的所有课程?
我正在使用composer自动加载所有依赖项.
我的目录结构如下所示:
/app
- controllers/
- Models/
- services/
index.php
/vendor
composer.json
Run Code Online (Sandbox Code Playgroud)
这是我的composer.json
档案.
{
"require": {
"slim/slim": "^3.3",
"monolog/monolog": "^1.19"
},
"autoload" : {
"psr-4" : {
"Controllers\\" : "app/controllers/",
"Services\\" : "app/services/",
"Models\\" : "app/models/"
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的index.php
档案.同样,依赖关系由作曲家自动注入
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../vendor/autoload.php';
$container = new \Slim\Container;
$app = new \Slim\App($container);
$app->get('/test/{name}', '\Controllers\PeopleController:getEveryone');
$app->run();
Run Code Online (Sandbox Code Playgroud)
我的控制器看起来像这样
<?php #controllers/PeopleController.php
namespace Controllers;
use \Psr\Http\Message\ServerRequestInterface as Request; …
Run Code Online (Sandbox Code Playgroud) 看看纠正Debian上/etc/init.d/hostapd中的问题.但是,我不知道这行代码是做什么的,也不知道它是如何工作的
[ -n "$DAEMON_CONF" ] || exit 0
Run Code Online (Sandbox Code Playgroud)
在网上搜索bash教程时,我从未见过有人这样做过
当我运行代码时,我的shell窗口关闭(因为$ DAEMON_CONF未设置为任何内容).如果我将代码更改为
[ -n "not empty" ] || exit 0
Run Code Online (Sandbox Code Playgroud)
我的控制台窗口没有关闭.
所以,-n的计算结果为真,而且,或者退出0,是什么?