const promise = new Promise((resolve, reject) => { setTimeout(() => { // resolve('success') reject('error') }, 1000) }) promise.then( (result) => { console.log(result,'成功') }, (error) => { console.log(error,"失败") } )