Ember JS和多个单页面应用程序 [英] Ember JS and Multiple single page apps

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

问题描述

说我有一个网络应用程序 - 一个大型,复杂的轨道应用程序,如会计应用程序。我看到用于几个单页面应用程序,而不是典型的轨道往返页面。例如,我可以通过一个直观的单页/动态应用程序看到更好的用户:




  • 创建银行对帐

  • 创建发票

  • 填写时间报告

  • 等..



这些都是不同的一页应用程序...



我看到的所有ember应用程序都是单页和单一目的。



我想要有许多单页面应用程序,用ember构建。如何看待:



路线:我会组合服务器路由和客户端路由。 Ember会怎么样?提供不同的Ember应用程序,每个应用程序都有自己的应用程序路由器和路由?



模板:所有我的applet是否会被编译并被加载到客户端?或者我会利用require.js并加载每个单独的页面应用程序,具体取决于它们是否被导航?
...



任何人都可以帮助这两个问题吗?
感谢提前!

解决方案


路线:我会组合服务器路由和客户端路由。 Ember会怎么样?提供不同的Ember应用程序,每个应用程序都有自己的应用程序路由器和路由?


取决于功能方面的重叠程度。确保您可以使用自己的路由器和路由服务不同的Ember应用程序。在这种情况下,您也可能会编写一个共享基础类和混合库的共享库。



另一种方法是让一个单一的ember应用程序的外观和行为有很大的不同,在路上。这是我开始的地方,直到你有一个很好的感觉,而且看到一个令人信服的理由将事情分开。


模板: applets得到编译并下载到客户端上?或者我会利用require.js并加载每个单独的页面应用程序,具体取决于它们是否被导航? ...


rails中阻力最小的路径是使用链轮来编译和打包您的模板 - 一旦编译,他们只是javascript。通常,rails应用程序将所有javascript捆绑到application.js中,并将其加载到加载中。另一种方法是将应用程序特定的代码和模板分解为app1.js,app2.js等,并在应用程序导航时加载每个代码。


Say I have a web app - a large, complex, rails app, like an accounting application. I see a use for several single page apps instead of the typical rails round tripping pages. For example, I can see a user better served with an intuitive single page/dynamic app for:

  • Creating Bank Reconciliation
  • Creating an Invoice
  • Filling out a Time Report
  • etc..

These are all distinct one page apps...

All the ember apps I see are single page and single purpose.

I want to have many single page apps, built with ember. How would that look with respect to:

Routes: I'd have a combination of server routes and client routes. How would that look in Ember? Serve different Ember applications, each with their own application router and routes?

Templates: Would all my "applets" get compiled and pushed down to the client on load? Or would I leverage require.js and load each single page app depending on if they're navigated to? ...

Can anyone help with those two questions? Thanks in advance!

解决方案

Routes: I'd have a combination of server routes and client routes. How would that look in Ember? Serve different Ember applications, each with their own application router and routes?

Depends on how much overlap there is in terms of features. For sure you could serve different Ember applications with their own router and routes. In that case you would probably also write a shared library with common base classes and mixins.

An alternative would be to have a single ember application that looks and behaves very differently depending on the route. That's where I would start until you have a good feel for ember and see a compelling reason to split things apart.

Templates: Would all my "applets" get compiled and pushed down to the client on load? Or would I leverage require.js and load each single page app depending on if they're navigated to? ...

Path of least resistance in rails is to use sprockets to compile and package your templates - once compiled they are just javascript. Typically a rails app will bundle all javascript into application.js and include that on load. An alternative would be to split application-specific code and templates into app1.js, app2.js, etc. and load each when the app is navigated to.

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

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