Backbone,Marionette,Talent学习笔记

具体以源码为准

Talent继承自Marionette继承自BackBone

 

 

Region:

  继承自Backbone.Event,show(view)会调用view.render(),然后$el.append(view.el),触发相应的事件

Layout:

  继承自 ItemView,可以设置regions属性

CompositeView:

  继承自collectionView,将Item添加到template中

  'itemview:deleteItem'事件

     itemViewOptions

CollectionView:

  继承自ItemView,将Item直接添加到$el中

ItemView:

  _deleteItem 自定义方法

  继承自View 

     inilialize:(options)接受options

     templateHelpers 赋值options的方式可以将collectionView,compositeView传过来的model合并到 itemview的model

collection:  

  where方法返回值是model数组而不是collection

 

 

 

避免 **-view-2.js的命名方式,而用**-view2.js(无法准确找到文件,可能是require的bug)

循环依赖是设计问题,应该打破循环,比如把另一个view A作为参数传到view B

backbone通过事件代理绑定事件,阻止事件冒泡即可防止事件在树形结构的dom中触发多次

 

posted @ 2014-09-23 11:05  三剑客  阅读(469)  评论(0编辑  收藏  举报