使用以下Thorax 2.0.1代码:
MyView = Thorax.View.extend({
events: {
'foo': 'bar'
},
template: 'Hello world'
});
foo = new MyView();
foo.bar = function() {}
尝试创建视图时出现以下错误:
Uncaught TypeError: Cannot read property '_thoraxBind' of undefined [VM] thorax.js (849):1
_.extend._addEvent [VM] thorax.js (849):1
(anonymous function) [VM] thorax.js (849):1
j.each.j.forEach underscore.js:79
_.extend.on [VM] thorax.js (849):1
(anonymous function) [VM] thorax.js (849):1
j.each.j.forEach underscore.js:87
h [VM] thorax.js (849):1
at.event.configure [VM] thorax.js (849):1
(anonymous function) [VM] thorax.js (849):1
j.each.j.forEach underscore.js:87
ot.View.Backbone.View.extend._configure [VM] thorax.js (849):1
a.View [VM] backbone-min.js (848):1
ot.View.Backbone.View.extend.constructor [VM] thorax.js (849):1
r [VM] backbone-min.js (848):1
(anonymous function) main.js:8
这是一个最小的复制。
为什么会出现这个错误?
PS:有更高代表的人可以添加thorax
标签吗?谢谢!