1
2
3
4
5
new Promise((resolve,reject)=>{
setTimeout(
function(){resolve(123)},1000)})
.then(res=>console.log(res))
.catch()
  • 其中reslove接受正确结果,导入到then
  • reject接受错误结果,导入到catch