axios等待同步请求
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)
});
}
用心完成每一件艺术品

浙公网安备 33010602011771号