js执行顺序,函数调用完,再往下执行

如何等函数调用完,再往下执行find语句,因为要用的调用方法中的改变的数据

img

img

img

helperList定义成异步函数:async helperList(){.....},调用helperList函数是:await _this.helperList.....

把helpList()改成Promise不就行了,或者把整个这一块都用async/await重写,也不至于层层嵌套

function helprList() {
    const _this = this;
    if (_this.test) return Promise.resolve();
    return getHelperList({}).then();
}

function onload() {
    helprList().then(_ => {
        console.log(" do find method here")
    }).catch(console.log)
}