解决js中异步改为同步执行函数顺序的问题
在js中会遇到某些想按顺序执行函数的情况,为了获取到上一个函数执行结果再执行下一个函数,但js中的函数调用是异步执行的。之前有试过对函数设置setTimeout,但未得到解决。解决方案(抛异常):function A () {return this.$http.get(`xxxxxxx`,{ ......}).then((dat)=>{ ......}).catch((error) { ...... throw error})},function B () {retu
原创
2021-10-28 09:37:59 ·
493 阅读 ·
0 评论