一页上有多个Aurelia应用程序 [英] Multiple Aurelia apps on one page

查看:70
本文介绍了一页上有多个Aurelia应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于关于Aurelia框架的信息不多,我对这两个问题感到困惑。

As there isn't much information about Aurelia framework I got stuck with these 2 questions.


  1. 是否有可能创建多个Aurelia单页上的应用程序和
    如何实现这一目标?

  2. 或者,有没有办法在主应用程序容器外的2个不同位置调用单个应用程序模板?


    • 例如,我想在CMS系统中使用Aurelia SPA,并在标题,主容器和旁边容器等不同元素中调用它。


推荐答案

是的,只需在页面中添加两个元素即可一个 aurelia-app 属性。

Yep, just add two elements to the page with an aurelia-app attribute.

这是一个例子: https://gist.run?id=2d310abbbea337fb5f6d110ec807f7d2

<!doctype html>
<html>
  <head>
    <title>Aurelia</title>
  </head>
  <body>
    <div aurelia-app="main1">
      <h1>Loading...</h1>
    </div>
    <div aurelia-app="main2">
      <h1>Loading...</h1>
    </div>
    ... 
  </body>
</html>

这篇关于一页上有多个Aurelia应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆