什么是对Backbone.js的意见适当的粒度? [英] What's the appropriate granularity for Backbone.js Views?

查看:115
本文介绍了什么是对Backbone.js的意见适当的粒度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我采用Backbone.js的渲染href=\"http://www.esvonline.org\">现有的大型web应用程序的

I'm adopting Backbone.js to render a small corner of an existing large web app. If this goes well, I can see Backbone.js growing to encompass the whole of the app, lending some much-needed structure to an organically-grown application. That's the preface. Now for the problem:

我有一个选择框,让用户选择阅读计划。当选择改变,视图更新一些描述性文字,日历界面,并标志着今天的读数完整的一个小部件。部件将具有每个读数(一个或多个)在今天的条目和用于继续第二天的读数的一个按钮的复选框。 (你可以看到这个界面上现有应用

I have a select box which allows the user to select a reading plan. When the selection changes, the view updates some descriptive text, a calendar interface, and a little widget for marking today's readings as complete. The widget will have a checkbox for each reading (one or more) in today's entry and a button for continuing to the next day's reading. (You can see the current, non-Backbone version of this interface (minus the completion scheme) on the right-hand side of the existing app.

什么是每个View适当的粒度?我已经确定了以下繁琐位:

What is the appropriate granularity for each View? I've identified the following "fiddly bits":


  • 标签本身,它包含了所有包含的控件。

  • 的选择框

  • 的描述文本,这是为了响应该选择框

  • 日历,这是为了响应该选择框

  • 读数小部件,它响应选择框,并包含:

    • (可选),一个开始按钮,激活当前计划。

    • 激活后,今天的条目中对应于各个读数的一个或多个复选框。

    • 激活后,一个下一步按钮,完成今天的条目,并显示下一个。

    如果每个要点的获得自己的看法?就在各大片(标签,选择框,窗口小部件)?首先将导致相当多的意见。第一个好像它可能导致过于复杂View实现。什么是最好的?

    Should each of these bullet points get its own View? Just the major pieces (tab, select box, widget)? The first will result in quite a few Views. The first seems like it could lead to overcomplicated View implementations. What's best?

    注:的我意识到这可能是PTED为疯狂,主观题间$ P $,但我还是我的包裹Backbone.js的周围和Javascript / DOM MVC模式的头,我M希望有一个狭窄的这是什么意图/效果最好从有经验的从业者Backbone.js的。谢谢!

    Note: I realize this could be interpreted as a wildly-subjective question, but I'm still wrapping my head around Backbone.js and Javascript/DOM MVC patterns, and I'm hoping that there is a narrow "this is what's intended/works best" from more experienced Backbone.js practitioners. Thanks!

    推荐答案

    有没有明确的回答你的问题。你可以看看SproutCore的粒度为exemples。

    There is no definitive answer to your question. You can have a look at the granularity of sproutcore for exemples.

    您还可以观看 http://vimeo.com/17186379 那里耶胡达·卡茨说明更新不同的困难个页面。

    You can also watch http://vimeo.com/17186379 where Yehuda Katz illustrate the difficulties of updating different pieces of the page.

    看它会检查哪些部分应该用不同的模式变革/事件被刷新,并尽量减少重新渲染的一种方式。

    One way of looking at it would be to check which part should be refreshed with different model change/events and try to minimize the re rendering.

    对不起没有好的答案,正如你所指出;)

    Sorry no good answers as you pointed out ;)

    这篇关于什么是对Backbone.js的意见适当的粒度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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