vue方法同步(顺序)执行:async/await使用
定义的方法:ps:方法是向后台请求数据async getStoreSceneList(CustomerID) {let that = this;let data = {CustomerID: CustomerID};await api.getStoreSceneEmployee(data).then(res => {if (res.error_code === "Success") {con
·
定义的方法:ps:方法是向后台请求数据
async getStoreSceneList(CustomerID) {
let that = this;
let data = {
CustomerID: CustomerID
};
await api.getStoreSceneEmployee(data).then(res => {
if (res.error_code === "Success") {
console.log(123)
} else {
that.$Message.error(res.error_message);
}
});
}
调用时:
let that=this
that.getStoreSceneList(res.ID).then(() => {
console.log(456)
})
结果:
先输出:123 后输出:456
更多推荐
已为社区贡献9条内容
所有评论(0)