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
VUE axios all()使用返回值報錯
紅糖糍粑
2018-12-29 19:14:06