promise.all

2019-12-11  本文已影响0人  gem_Y
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)
  })
上一篇下一篇

猜你喜欢

热点阅读