后端传递的数据在多层括号里面该怎么取用其中的一个数据,只想把结果中的fid传入collectlist数组中,搞了半天没弄出来,怎么改啊,希望直接把改的结果发出来。
querybyfid(uid){
this.$http.get("/ky/collect//querycollect?uid="+uid).then(function (result){
//console.log(result.body);
this.collectlist = result.body;
this.collectsum = result.body.length;
console.log(this.collectlist );
console.log(this.collectsum);
})
},
this.collectlist = result.body.map(el=>el.fid)
可以远程
使用map方法,提取每一项的对应的属性,构成一个新的数据;
this.collectlist = result.body.map(item => item.fid);