问题描述
我收到此错误:
Uncaught TypeError: Cannot read property 'trigger' of undefined
在我的主干视图中。它说我的 this
函数中的 updateModel
未定义。
但我不明白为什么,因为我在整个视图的其余部分都使用了 this
,没有任何问题。他们都被认可了。
这是有问题的代码块。如您所见,我在其他地方成功使用了 this
。
为什么它在我的 updateModel
函数中不起作用?
events() {
'click #moreData': 'renderMain',},render: function() {
// bunch of code related to styling and changing css
return this;
},renderMain(e) {
setTimeout(_.bind(this.loadData,this),1);
},loadData: function () {
this.renderComponent(microPlane,{
model: this.model,updateModel: this.updateModel },'.modelLayout');
},updateModel: function () {
this.trigger('change',this.model);
}
我就是想不通:/
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)