我尝试从对象获取值但是,当我尝试访问它时,我得到错误:
TypeError: this.datas[adragged] is undefined
我尝试调试代码,所以我添加了几个console.log
console.log(adragged);
结果:973
console.log(console.log(JSON.stringify(this.datas[adragged])));
结果:
{"name":" Наташа ","lname":"","fname":"Наташа","mname":"","id":"973","mother":"900","father":"972","x":0,"y":0,"sex":"F","dbirthd":"","diedate":"","dx":0,"dy":0}
console.log(this.datas);
结果为:
Array [ <10 пустых элементов>, ещё 964… ]
和
973:Object
存在且填充了值
console.log(this.datas[adragged]);
结果:
Object { name: " Наташа ", lname: "", fname: "Наташа", mname: "", id: "973", mother: "900", father: "972", x: 0, y: 0, sex: "F", ещё 4… }
但是当我尝试从id
这样的对象中获取postData.id = this.datas[adragged].id;
时,我会在此行中收到错误TypeError: this.datas[adragged] is undefined
。
我缺少什么?