1.async,await
mounted() {
this.getTime();
this.queryPlanMonthly();
this.queryVehicleMonthly();
},
async queryVehicleMonthly() {
console.log("queryVehicleMonthly");
const res = await queryVehicleMonthly(this.queryInfo);
console.log("queryVehicleMonthly");
},
async queryPlanMonthly() {
console.log("queryPlanMonthly");
const res = await queryPlanMonthly(this.queryInfo);
console.log("queryPlanMonthly");
},
async getTime() {
console.log("gettime");
const res = await queryOrderMonthly(this.queryInfo);
console.log("gettime");
},
执行结果(先同步后异步,由于加了async和await顺序执行):
2.promise,then()
同上