注意:与.then和.carth的使用方式一样,这个放在最后,一般是加载完成后执行的操作,比如下面的关闭菊花加载图标
不管promise最后的状态,在执行完.then或.catch指定的回调函数以后,都会执行finally方法指定的回调函数。
.then(()=>{
console.log('成功')
}).catch(()=>{
console.log('失败')
}).finally(()=>{
this.loading = false
})
注意:与.then和.carth的使用方式一样,这个放在最后,一般是加载完成后执行的操作,比如下面的关闭菊花加载图标
不管promise最后的状态,在执行完.then或.catch指定的回调函数以后,都会执行finally方法指定的回调函数。
.then(()=>{
console.log('成功')
}).catch(()=>{
console.log('失败')
}).finally(()=>{
this.loading = false
})