res.data.list 的数据 [{…}, {…}, {…}] 是数组里套json的形式
我想把res.data.list 循环放到一个数组里 (因为要请求很多次数据,把每次返回的数据放在一个数组里处理)
但是输出的数组显示的是这样的
[__ob__: Observer]
{…}
{…}
{…}
{…}
length:4
__ob__:Observer {value: Array(4), dep: Dep, vmCount: 0}
__proto__:Array
typeof 是object 没法用数组的方法
that.diviCot=[];//要输出的数组
for(var i in this.otherCat){
getDivinationCont(this.otherCat[i].id).then(function(res){ //从后台取数据
if(res.code<10000){
console.log(res.data.list)// 返回的数据
for(var t in res.data.list){//循环返回的数据
that.diviCot.push(res.data.list[t]); //放进声明的数组里
};
};
})
};
for in 和for of 都试了
实在是不知道了。。