ES9 Promise 拓展 Promise.prototype.finally()
// ES9 Promise 拓展 Promise.prototype.finally() // 成功失败都会执行
new Promise((resolve, reject) => {
setTimeout(() => {
// resolve('成功')
reject('fail')
}, 1000)
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
}).finally(() => {
console.log('finally')
})
// 场景应用 使loading消失
// 数据库关闭操作

浙公网安备 33010602011771号