基础接口
getlistDemo() {
this.$api.index_api.fooApi({}).then(async () => {
console.log('1 - 1 - 1 - 1 - 1');
let awaitResult = await this.promiseDemo('2 - 2 - 2 - 2 - 2')
console.log(awaitResult)
})
}
回调接口
promiseDemo(sno) {
console.log(sno);
return new Promise(resolve => {
this.$api.index_api.barApi({}).then(() => {
console.log('3 - 3 - 3 - 3 - 3')
resolve('5 - 5 - 5 - 5 - 5')
console.log('4 - 4 - 4 - 4 - 4')
});
})
}

错误示例

文章详细描述了如何在JavaScript中使用异步接口技术,如changeMealHh函数通过$api创建订单容器并处理支付,以及payApply函数作为回调进行订单支付操作的实现过程。
1613

被折叠的 条评论
为什么被折叠?



