axios等待同步请求
时间:2020-12-30 11:21:01
收藏:0
阅读:0
axios等待同步请求
methods: {
getLightList() {
let that = this;
return new Promise((resolve, reject) => {
that.query.type = ‘0‘;// 灯光
getLightList(this.query).then(res => {
that.lightList = res.data.data;
resolve(res.data.data)
});
})
},
async getCrossList () {
let that = this;
let lightList = await this.getLightList();
this.query.type = ‘1‘;// 能耗
getLightList(this.query).then(res => {
that.crossList = res.data.data;
console.log(lightList.length)
console.log(that.crossList.length)
});
}
评论(0)