使用以下代码:
import { Aurelia } from "aurelia-framework";
export async function configure(aurelia) {
aurelia.use.standardConfiguration().developmentLogging();
await aurelia
.start()
.then(a => a.setRoot())
//.then(a => a.setRoot("app.js", document.body))
.catch(ex => {
document.body.textContent = `Bootstrap error: ${ex}`;
});
}
我收到此错误:
引导错误:错误:未指定应用程序主机。
如果我改用使用.then(a => a.setRoot("app.js", document.body))
而不是.then(a => a.setRoot())
一切正常。
在 Aurelias 自己的快速入门指南中,他们使用以下代码:
import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia) {
aurelia.use.basicConfiguration();
aurelia.start().then(() => aurelia.setRoot());
}
如果我切换到use.basicConfiguration
我的代码,我仍然会遇到同样的错误。
https://aurelia.io/docs/tutorials/creating-a-todo-app#getting-ready-to-render
Codesandbox 重现: