vue Promise all

所有执行完成后,回调

Promise.all([
  new Promise(resolve => {
    setTimeout(() => {
      console.log('furong');

      resolve({
        name: 'furong',
        age: 12
      });
    }, 2000)
  }),
  new Promise(resolve => {
    setTimeout(() => {
      console.log('quange');

      resolve({
        name: 'quange',
        age: 24
      });
    }, 1000)
  }),
]).then(data => {
  console.log(data);
})

posted @ 2021-07-13 14:08  thomas_blog  阅读(74)  评论(0编辑  收藏  举报