Aurelia 配置
 
 在本章中,我们将向您展示如何根据您的需要配置 Aurelia 框架。有时您需要在应用呈现给用户之前设置初始配置或运行一些代码。
 
第 1 步-创建 main.js
 
 让我们在 
 src 文件夹中创建 
 main.js 文件。在这个文件中,我们将配置 Aurelia。
 
 您还需要告诉 Aurelia 加载配置模块。您可以在以下示例中看到注释部分。
 
index.html
 
 
 
  <!DOCTYPE html>
<html>
   <head>
      <title>Aurelia</title>
      <link rel = "stylesheet" href = "styles/styles.css">
      <meta name = "viewport" content = "width=device-width, initial-scale = 1">
   </head>
   <body aurelia-app = "main"> 
      <!--Add "main" value to "aurelia-app" attribute...-->
      <script src = "jspm_packages/system.js"></script>
      <script src = "config.js"></script>
		
      <script>
         SystemJS.import('aurelia-bootstrapper');
      </script>
   </body>
</html>
 
   
  
第 2 步-默认配置
 
 下面的代码展示了如何使用默认配置。 
 configure 功能允许手动设置配置。我们正在设置 
 use 属性来指定我们需要的内容。
 
main.js
 
 
 
  export function configure(aurelia) {
   aurelia.use
   .standardConfiguration()
   .developmentLogging();
   aurelia.start().then(() => aurelia.setRoot());
}
 
   
  
第 3 步-高级配置
 
 我们可以使用很多配置选项。向您展示所有内容超出了本文的范围,因此我们将解释配置如何在以下示例中工作。我们基本上是告诉 Aurelia 使用
 默认数据绑定语言、默认资源、开发日志、路由器、历史和
 事件聚合器。这些是标准的插件集。
 
 
 
  export function configure(aurelia) {
   aurelia.use
   .defaultBindingLanguage()
   .defaultResources()
   .developmentLogging()
   .router()
   .history()
   .eventAggregator();
   aurelia.start().then(() => aurelia.setRoot());
}
 
   
  
 注意-这些设置将在下一章中详细解释。