data(){
return {
tabledata: [],
oftenGoods: [],
}
},
created: function () {
axios.all([
axios.get('test1.php'),
axios.get('test2.php')
]).then(axios.spread(function(oftenResp, typeResp) {
console.log(oftenResp.data);
console.log(typeResp.data);
this.tabledata= typeResp.data
}))
.catch(error=>{
console.log(error);
})
},
返回的两个响应数据都能拿到, 打印也是成功的
this.tabledata= typeResp.data //这句赋值的时候报错TypeError: Cannot read property 'tabledata' of null
MYYA
相关分类