Promise.allSettled使用

Promise.allSettled使用_第1张图片

 

1、const apiList = await Promise.allSettled([systemApi]).then((result: any) => {

    if (result[0].status === 'fulfilled') {

      console.log(result[0].value)

      return result[0].value.data

    }

  })

  console.log(apiList, 'apiList')


2、

const systemApi = new Promise((resolve, reject) => {

  const result = post({

    url: systemSetting,

    data: {},

  })

  return resolve(result)

})

你可能感兴趣的:(javascript,前端,vue.js)