美文网首页
promise.all

promise.all

作者: gem_Y | 来源:发表于2019-12-11 18:00 被阅读0次
    export function getMenuListAndPermision() {
      let resolveCb = null
      let rejectCb = null
      const promise = new Promise((resolve, reject) => {
        resolveCb = resolve
        rejectCb = reject
      })
      Promise.all([
        getPermissionList(),
        getLeftMenuList(),
        getAllMenuList()
      ]).then(res => {
       ....
        resolveCb(...)
      }).catch(err => {
        console.error('getMenuListAndPermision err:', err)
        rejectCb(err)
      })
      return promise
    }
    
    getMenuListAndPermision().then(res => {
    })..catch(err => {
        console.error('err:', err)
      })
    

    相关文章

      网友评论

          本文标题:promise.all

          本文链接:https://www.haomeiwen.com/subject/pdkbgctx.html