【发布时间】:2012-11-06 20:52:46
【问题描述】:
我刚刚将backbone.marionette 从0.9.3 更新到v1.0.0-beta4,下面的代码被破坏了:
PlansApp.CompositeView = Backbone.Marionette.CompositeView
PlansApp.ItemView = Backbone.Marionette.ItemVie
PlansApp.Plans.PlansList = do ({PlansApp, Backbone} = window) ->
PlansList = {}
PlansListItemView = PlansApp.ItemView.extend
initialize: ->
@bindTo this.model, "change", this.modelChanged
modelChanged: (model, value)->
this.render()
this.$el.effect("highlight", {}, 6000)
window.addTeachMeHandlers() if model.get 'IsFirst
它专门破坏了 this.render() 并显示错误消息:
Uncaught TypeError: Object [object Object] has no method 'render'
此代码以前用于升级之前的工作。
从源码看,ItemView还有一个render方法,所以我猜测是上下文错误或者可能是bindTo发生了变化。
我也将下划线从 1.3 升级到 1.4.1
【问题讨论】:
标签: marionette