我不明白为什么 DOM 在集合视图渲染中没有更新:
类 FastTodo.Views.TodoItemsIndex 扩展 Backbone.View
模板:JST['todo_items/index']
埃尔:'#main'
渲染:->
$(@el).html @form_view.render()
@collection.each @renderOne
renderOne:(项目)->
控制台日志(@)
控制台日志(@el)
$(@el).append "模型数据"
初始化:->
@collection = new FastTodo.Collections.TodoItems()
@form_view = 新的 FastTodo.Views.AddTodoItem 集合:@collection
@collection.bind '重置',=>
@使成为()
@collection.on 'add', (item) =>
@renderOne(项目)
@collection.fetch()
这个想法是#main 首先获取一个带有添加新表单的视图,然后将集合附加到#main。
我该怎么做?
控制台中视图的输出如下所示: