当前位置:网站首页>Function: multi file upload and unified submission
Function: multi file upload and unified submission
2022-06-09 18:46:00 【[email protected]】
One 、 demand :
The front-end realizes multi file uploading , Uniformly submit the data returned by the server after uploading , Submit and save the last file immediately after uploading , No time interval .
Two 、 Thought analysis :
2.1、 Click upload --> call file Method --> call upload Method , We define two variables flagA and flagB, Record the number of times the two methods are executed , Every time you execute +=1,file Execute first ,upload After execution , therefore upload After the method, we compare flagA and flagB Value , If flagA Greater than flagB There are still files to upload , If flagA be equal to flagB The description is the last file . This is the time when we call save .
2.2、 Take uploading three files as an example :
| file | upload | contrast flag | result | |
| file 1 | flagA+=1 | flagB+=1 | flagA > flagB | Upload not completed |
| file 2 | flagA+=1 | flagA+=1 | flagA > flagB | Upload not completed |
| file 3 | flagA+=1 | flagA+=1 | flagA = flagB | Upload to complete , Execution method |
3、 ... and 、 Code :
3.1、 Definition flag:
flagA: 0, // Record file
flagB: 0, // Record upload3.2、 Record file:
toRequestFile(data) {
this.flagA += 1
this.toRequest(data, 'file');
},3.3、 Record upload:
toRequest(data, type) {
const fd = new FormData();
fd.append('file', data.file);
commonUpload(fd).then(res=>{
this.$message({ type: 'success', message: ' Upload successful ' });
}).finally(()=>{
this.flagB += 1 // Record upload
console.log('914flagA-flagB', this.flagA, this.flagB)
})
},3.4、 effect :
![]()
Upload three files , Three times upload Execute finish printing 3,3, It indicates that all three files have been executed .
Four 、 Welcome to communicate and correct , Pay attention to me , Learning together .
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091806189033.html
边栏推荐
- Inspur cs5280h raid scheme details
- 循环结构程序设计2
- 220609-R
- What should I do if the RTMP stream address returned by easynvr non demand streaming cannot be played?
- Win10安装WSL1在D、E、F盘
- MySQL删除方法delete、truncate、drop的区别是什么
- 11年程序员给本科、研究生应届生以及准备从事后台开发同学的建议,学习进阶之路
- C# 34. UdpClient收发
- WSL 挂载U盘
- 20220529 how to convert subtitles in MKS format into subtitles in SRT, ass, SSA and IDX formats txt
猜你喜欢

Will quic become a disruptor of Internet transmission?

How to realize face verification quickly and accurately?
![[high level knowledge] epoll implementation principle of user mode protocol stack](/img/47/1ab66811bdd90ec1365a4a1e18d940.png)
[high level knowledge] epoll implementation principle of user mode protocol stack

如何利用无线通讯技术优化钢铁厂消防用水管网?

【SOLIDWORKS-详细记录】测量方法、设置草图自动正视基准面、设置滚轮放大缩小方向、螺丝添加螺纹线等操作记录

有源差分探头在USB2.0一致性分析测试的准备工作

3 个注解,优雅的实现微服务鉴权

为何罗氏探头测量高频电流会出现误差?
![[pb03f environment setup] Bluetooth 5.2 Anxin Ke pb-03f-kit development board secondary development environment setup](/img/48/c97ee18d8e4cb31382c4233df11dd8.png)
[pb03f environment setup] Bluetooth 5.2 Anxin Ke pb-03f-kit development board secondary development environment setup

10个常见触发IO瓶颈的高频业务场景
随机推荐
Safe account opening procedures for futures companies?
微服务中使用阿里开源的TTL,优雅的实现身份信息的线程间复用
My younger brother Dan Teng, yincuisiting, is a robot human typewriter~~~~~~
【PB03F 环境搭建】蓝牙5.2安信可PB-03F-Kit开发板二次开发环境搭建
Golang基础(3)
避免惊群以及负载均衡的原理与具体实现
请问为什么不能够在DF的foreachPartition方法调用的函数方法中引用redis模块呢?
C# 32. Select a network card from the static class implementation drop-down box
Golang Foundation (5)
Talk about MQ technology selection
外汇交易MT4是什么软件?MT4与MT5有何区别?下载MT4要注意什么?
Ad delete dimension
Jsonpath tutorial
mfc连接数据库显示未发现数据源名称并且未指定默认驱动程序
For 11 years, the programmer gave suggestions to undergraduate, graduate students and students preparing to engage in background development to learn the way to advance
Gee | seeking improved version of NDVI
CORTEX-A9三星iTOP-4412开发开发板入门嵌入式
Loop structure programming 2
Win10 installs wsl1 on disks D, e and F
【SOLIDWORKS-详细记录】解决默认模板无效问题及添加自定义模板