前端框架Aurelia - GlobalResources()

Introduction

你可能有许多资源需要在多个页面使用。这时候将这些资源做成全局的是明智的。
框架配置class提供了globalResources方法,这个方法的参数是一个或者多个string,这些string是资源的path。
全局的resources不需要在template里面require。
配置Aurelia的文件有一个configure方法。

我们项目里面layout文件夹下的index.js文件

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .globalResources('custom-element`, 'another-directory/custom-attribute');

  aurelia.start().then(() => aurelia.setRoot());
}

你可能感兴趣的:(Aurelia,Aurelia)