当前位置:网站首页>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;
});
边栏推荐
- CX5120控制汇川IS620N伺服报错E15解决方案
- Subnet division (10)
- ECMAScript 6.0
- 【小程序项目开发-- 京东商城】uni-app之首页商品楼层
- Summary of problems encountered in debugging positioning and navigation
- [applet project development -- Jingdong Mall] user defined search component of uni app (Part 1)
- Cloud native annual technology inventory is released! Ride the wind and waves at the right time
- 手把手带你了解一块电路板,从设计到制作(干货)
- Example of Huawei operator level router configuration | example of configuring optionc mode cross domain LDP VPLS
- Dart training and sphygmomanometer inflation pump power control DPC
猜你喜欢
The best learning method in the world: Feynman learning method
Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example
实战 ELK 优雅管理服务器日志
[machine learning] vectorized computing -- a must on the way of machine learning
POI exports excel and displays hierarchically according to parent-child nodes
雪崩问题以及sentinel的使用
So easy 将程序部署到服务器
HTB-Lame
Cloud native annual technology inventory is released! Ride the wind and waves at the right time
Detailed explanation of pointer array and array pointer (comprehensive knowledge points)
随机推荐
HTB-Lame
VMware vSphere 6.7 virtualization cloud management 12. Vcsa6.7 update vCenter server license
Best used trust automation script (shell)
Stop saying that you can't solve the "cross domain" problem
第03章_用户与权限管理
[linear DP] shortest editing distance
JUC learning
Clion and C language
Introduction to webrtc concept -- an article on understanding source, track, sink and mediastream
Huawei operator level router configuration example | configuration static VPLS example
多元线性回归
Mybati SQL statement printing
监听器 Listener
C语言多线程编程入门学习笔记
pytest-fixture
The best learning method in the world: Feynman learning method
伺服第二编码器数值链接到倍福PLC的NC虚拟轴做显示
【机器学习】向量化计算 -- 机器学习路上必经路
xxl-job使用指南
Introduction and basic knowledge of machine learning