当前位置:网站首页>Finally in promise
Finally in promise
2022-07-01 03:20:00 【Brave Xiao Chen】
Promise In addition to the commonly used then and catch Outside ,finally It's also very important .
One 、finally The role of
No matter promise The final state , The execution of the then or catch After the specified callback function , It will be carried out finally Callback function specified by method .
Two 、 Application scenarios
In projects, we often encounter some functions of loading effects , Generally, the page displays the loading effect before the request , Cancel the page loading effect after the request is completed , I first put the logo on then Go inside and deal with , Later, I found that if the request is wrong , The page has been loaded and cannot be cancelled , Put the logo on the finally To deal with , So it solved the problem
equipmentApi
.adddingNode(data)
.then(({ code, message }) => {
if (code === 200) {
this.$message.success(" Added successfully !");
this.getTreeData();
this.handleCheck();
this.cancel();
} else if (code === 40001) {
} else {
this.$message.error(message);
}
})
.finally(() => {
this.buttonLoading = false;
});边栏推荐
- [applet project development -- JD mall] uni app commodity classification page (first)
- Introduction to EtherCAT
- LeetCode_ Stack_ Difficulties_ 227. basic calculator (excluding multiplication and division)
- Install vcenter6.7 [vcsa6.7 (vCenter server appliance 6.7)]
- Keil5中如何做到 0 Error(s), 0 Warning(s).
- Redis 教程
- 终极套娃 2.0 | 云原生交付的封装
- 【读书笔记】《文案变现》——写出有效文案的四个黄金步骤
- 过滤器 Filter
- JUC learning
猜你喜欢
随机推荐
[us match preparation] complete introduction to word editing formula
Chapter 03_ User and authority management
Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example
8 pits of redis distributed lock
咱就是说 随便整几千个表情包为我所用一下
第03章_用户与权限管理
split(),splice(),slice()傻傻分不清楚?
彻底解决Lost connection to MySQL server at ‘reading initial communication packet
Hello World generation
[exsi] transfer files between hosts
Network address translation (NAT) technology
MySQL index --01--- design principle of index
CX5120控制汇川IS620N伺服报错E15解决方案
文件上传下载
Introduction and installation of Solr
How the network is connected: Chapter 2 (Part 2) packet receiving and sending operations between IP and Ethernet
Common interview questions for performance test
Stop saying that you can't solve the "cross domain" problem
Ctfshow blasting WP
别再说不会解决 “跨域“ 问题啦




![[linear DP] shortest editing distance](/img/2f/9a6f661bf478fdd5d53e5a03d7297d.jpg)




