简体   繁体   English

单页面webapp所需的设计建议

[英]Design recommendations needed for single page webapp

We need to change/rewrite an existing series of pages/workflow screens into one standard page. 我们需要将现有的一系列页面/工作流程屏幕更改/重写为一个标准页面。 The project in itself will essentially be to build a single web page app inside the context of a larger existing application. 该项目本身就是在较大的现有应用程序的上下文中构建单个网页应用程序。

Our goal is to leave the server side implementation the way it is as much as possible. 我们的目标是尽可能地保持服务器端的实现方式。 This means we won't be using a REST model, but rather just some form submissions to a java backend. 这意味着我们不会使用REST模型,而是使用一些表单提交到java后端。 Each end point will point to a JSP. 每个端点都将指向一个JSP。

Each form will be created as a widget. 每个表单都将创建为一个小部件。 When one widget submits it may affect the value of the other widgets which need to change their values on the fly. 当一个窗口小部件提交时,它可能会影响需要动态更改其值的其他窗口小部件的值。

It seems the 2 main options for single page web apps are Backbone.js or Ember.js. 单页Web应用程序的两个主要选项似乎是Backbone.js或Ember.js。

Given our requirements, which of these 2 (or any other frameworks) will fit best? 根据我们的要求,这两个(或任何其他框架)中的哪一个最适合? Or is there some other approach all together we should take? 或者我们应该采取其他一些方法吗?

Did you have a look at AngularJS ? 你看过AngularJS了吗? It is more comparable to EmberJS. 它与EmberJS更具可比性。

I would recommend you EmberJS for the moment, as it is more mature in term of ecosystem (Routing, Data, ...) 我会推荐你​​EmberJS,因为它在生态系统方面更成熟(路由,数据......)

Backbone is lower-level than both precedents. Backbone比​​两个先例都低。

Either will accomplish what you want. 要么完成你想要的东西。

I am partial to Ember as it provides a Routing/statechart framework which really helps lock an application's behavior down. 我偏爱Ember,因为它提供了一个路由/状态图框架,它真正有助于锁定应用程序的行为。 Not to mention that it is MVC, which will help you separate your concerns. 更不用说它是MVC,它将帮助您分离您的顾虑。 Each form or widget in your app will be a view that you define, binding inputs to your model layer. 应用中的每个表单或窗口小部件都是您定义的视图,将输入绑定到模型层。

There are probably a bunch of things you should look into. 可能有很多事情你应该研究。

Emberjs is 42k minified+gzip while Backbone.js is just 5.6kb. Emberjs缩小了42k + gzip,而Backbone.js仅为5.6kb。 Emberjs packs a lot of power in it which the barebones Backbone doesn't give you. Emberjs包含了很多力量,而后者骨干不会给你。

Analyse if you even need all those features. 分析您是否需要所有这些功能。 If your requirements are covered by just Backbone, IMO you should give Emberjs a pass. 如果您的要求仅由Backbone,IMO承担,您应该给Emberjs一个通行证。 Shipping all those extra bits for no use is foolish. 运送所有这些额外的位是没有用的是愚蠢的。

With Emberjs, you will have to use jQuery as well. 使用Emberjs,您还必须使用jQuery。 Not sure if you are already using it or not. 不确定您是否已经使用它。

IMHO, I would use Emberjs if the single page web app is super complex with lots of feature requirements else Backbone should suffice. 恕我直言,如果单页网页应用程序超级复杂且具有许多功能要求,我会使用Emberjs,否则Backbone就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM