代码拉取完成,页面将自动刷新
req();
function req1() {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject('error1');
// resolve('data1');
}, 2000);
});
}
function req2() {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject('error2');
// resolve('data2');
}, 2000);
});
}
async function req() {
// try {
// const res1 = await req1();
// console.log(res1);
// const res2 = await req2();
// console.log(res2);
// } catch (error) {
// console.log(error);
// }
const res1 = await req1().then(res => {
console.log(res);
}).catch(err => {
console.log(err);
});
const res2 = await req2().then(res => {
console.log(res);
}).catch(err => {
console.log(err);
});
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。