簡體   English   中英

嵌套Aurelia應用程序

[英]Nested Aurelia applications

根據Aurelia的創建者Rob Eisenberg的說法,應該可以在彼此內部嵌套aurelia應用程序

由於他在上面的鏈接中提到的示例不再公開,因此如果這里有人可以進一步闡述,甚至鏈接或編寫一個有關如何實現這種嵌套的小示例 ,這將非常有幫助。

我希望使用Aurelia創建的主要應用程序和界面將由Windows XP Desktop樣式的外殼組成,其中可以從開始菜單打開嵌套的Aurelia應用程序,並在主要應用程序內的嵌入式窗口中打開“ Windows桌面區域”-類似於Windows或文件資源管理器,可以在常規Windows XP OS中但在SPA中打開。

為了使它真正可擴展,我寧願保留將嵌套的aurelia應用程序放置在主應用程序根文件夾之外的文件夾中的可能性,而是使用磁盤上的文件/文件夾路徑從主應用程序鏈接到它們。

因此,為了使其“簡單”,請想象這將是主要應用程序 (Windows Shell)-單擊該按鈕將打開一個窗口,該窗口可以最小化,調整大小或移動。 在該窗口中,將打開另一個aurelia應用程序。 最后,您希望能夠將某些狀態從主應用程序轉移到嵌套應用程序,例如。 語言或數據庫。

並且如果可能的話,最好是可以從主應用程序根文件夾的外部定位並引用嵌套的應用程序。

這是一個示例: https : //gist.run?id=7cda93aa0a225805ddf6

app.html

<template>
  <require from="./child-app"></require>

  <child-app main.bind="main1"></child-app>
  <child-app main.bind="main2"></child-app>
</template>

app.js

export class App {
  main1 = './one/app';
  main2 = './two/app';
}

child-app.js

import {
  Aurelia,
  noView,
  bindable,
  inject,
  Container
} from 'aurelia-framework';
import {Loader} from 'aurelia-loader';

@noView()
@inject(Loader, Element)
export class ChildApp {
  @bindable main;

  constructor(loader, element) {
    this.host = element;
    this.app = new Aurelia(this.loader, new Container());
    this.app.use.standardConfiguration();
  }

  mainChanged() {
    this.app.start().then(a => a.setRoot(this.main, this.host));
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM