未捕获的TypeError:对象[对象DOMWindow]在backbone-min.js上没有方法'set'

时间:2022-09-08 12:19:27

I am receiving this error message when including backbone in my application,

在我的应用程序中包含骨干时,我收到此错误消息,

Uncaught TypeError: Object [object DOMWindow] has no method 'set'

未捕获的TypeError:对象[对象DOMWindow]没有方法'set'

but I have jquery (1.4.4) and underscore.js (1.1.7) loaded before backbone, why is this method still missing?

但是我在主干之前加载了jquery(1.4.4)和underscore.js(1.1.7),为什么这个方法仍然缺失?

2 个解决方案

#1


5  

Or you are instantiating a model without new prefix which would cause it to be bound to global window instead of this. SO reference.

或者您正在实例化一个没有新前缀的模型,这会导致它被绑定到全局窗口而不是这个。所以参考。

#2


1  

Based solely on the error message, I would search your code for this.set. It appears that you're referencing thiswith the expectation that it's a model, but the function isn't bound correctly.

仅基于错误消息,我会在您的代码中搜索this.set。看来您正在引用它,期望它是一个模型,但函数没有正确绑定。

#1


5  

Or you are instantiating a model without new prefix which would cause it to be bound to global window instead of this. SO reference.

或者您正在实例化一个没有新前缀的模型,这会导致它被绑定到全局窗口而不是这个。所以参考。

#2


1  

Based solely on the error message, I would search your code for this.set. It appears that you're referencing thiswith the expectation that it's a model, but the function isn't bound correctly.

仅基于错误消息,我会在您的代码中搜索this.set。看来您正在引用它,期望它是一个模型,但函数没有正确绑定。