gpt4 book ai didi

javascript - 没有方法 'has'

转载 作者:行者123 更新时间:2023-11-29 16:22:56 26 4
gpt4 key购买 nike

模型的属性...

attributes: Object
array: Array[1]
id: "ef93fcc0d431d1000003"
state: "new"

我正在设置...我所做的唯一不同是向数组添加了另一个值。

model =
array: Array[2]
id: "ef93fcc0d431d1000003"
state: "new"
__proto__: Object

我像这样扩充数组......

new_array = model.get('array').slice()
new_array.push new_value
model.set({array: new_array})

完全错误...

Object function (obj) { return new wrapper(obj); } has no method 'has'

这是抛出它的 Backbone.js 的一部分......

  // Update attributes.
for (attr in attrs) {
val = attrs[attr];
if (!_.isEqual(now[attr], val)) delete escaped[attr];
options.unset ? delete now[attr] : now[attr] = val;
delete this._changed[attr];
if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) {
Uncaught TypeError: Object function (obj) { return new wrapper(obj); } has no method 'has'
this._changed[attr] = val;
}
}

这是从服务器发送的更新。

只是寻找一些想法或方向来找出导致此错误的原因。

谢谢!

最佳答案

看起来您的代码引用了 Underscore.js .也许那是失踪?

关于javascript - 没有方法 'has',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9250791/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com