当前位置:网站首页>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;
});边栏推荐
- 最好用的信任关系自动化脚本(shell)
- How to verify whether the contents of two files are the same
- Summary of problems encountered in debugging positioning and navigation
- Redis efficient like and cancel function
- 打包iso文件的话,怎样使用hybrid格式输出?isohybrid:command not found
- 过滤器 Filter
- 雪崩问题以及sentinel的使用
- EDLines: A real-time line segment detector with a false detection control翻译
- VMware vSphere 6.7 virtualization cloud management 12. Vcsa6.7 update vCenter server license
- # 使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的'心路(累)历程'
猜你喜欢

Network address translation (NAT) technology

CX5120控制汇川IS620N伺服报错E15解决方案

JUC学习

Depth first traversal of C implementation Diagram -- non recursive code

Nacos

Mysql知识点

Kmeans

Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS

XXL job User Guide

实战 ELK 优雅管理服务器日志
随机推荐
Druid监控统计数据源
【机器学习】向量化计算 -- 机器学习路上必经路
HTB-Lame
Feign远程调用和Getaway网关
伺服第二编码器数值链接到倍福PLC的NC虚拟轴做显示
第03章_用戶與權限管理
岭回归和lasso回归
The 'mental (tiring) process' of building kubernetes/kubesphere environment with kubekey
[QT] add knowledge supplement of third-party database
JS日常开发小技巧(持续更新)
How do spark tasks of 10W workers run? (Distributed Computing)
Redis高效点赞与取消功能
【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)
MySQL knowledge points
POI导出excel,按照父子节点进行分级显示
A shooting training method based on the digital measurement of Joule energy and posture of sphygmomanometer air bag with standard air pressure
Magnetic manometer and measurement of foreign coins
Error accessing URL 404
Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
The best learning method in the world: Feynman learning method