Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加对上传文件的监听 #34

Open
wybiubiu1012 opened this issue Mar 26, 2019 · 24 comments
Open

添加对上传文件的监听 #34

wybiubiu1012 opened this issue Mar 26, 2019 · 24 comments

Comments

@wybiubiu1012
Copy link

wybiubiu1012 commented Mar 26, 2019

umi-request是基于fetch的封装,当上传文件时,如何对上传文件的进度进行监听呢,像xhr.upload.onprogress

@clock157
Copy link
Contributor

clock157 commented Mar 30, 2019

有一个 issue 在跟进中,但现在还没有实现,我会继续关注。 whatwg/fetch#607

@ifyour
Copy link

ifyour commented Jan 6, 2020

这个是不是要在 README.md 中特性部分进行体现呢 😂,暂时没有实现 axios onUploadProgress 以及 XMLHttpRequest: progress event

@elaoshi
Copy link

elaoshi commented Jul 4, 2020

有什么新进展么?

@laosandegudai
Copy link

有进展么?

@laosandegudai
Copy link

这个可以customRequest自定义上传然后用OnProgress控制进度,虽然文档没写但是有个这个OnProgress方法的。

@Hnnphone
Copy link

这个可以customRequest自定义上传然后用OnProgress控制进度,虽然文档没写但是有个这个OnProgress方法的。

问题是你怎么去拿进度,而不是用进度。。。

@laosandegudai
Copy link

这个可以customRequest自定义上传然后用OnProgress控制进度,虽然文档没写但是有个这个OnProgress方法的。

问题是你怎么去拿进度,而不是用进度。。。

都自己上传了还拿不到进度?

@America-first-melon
Copy link

  • 1

@zywkuo
Copy link

zywkuo commented Jun 23, 2021

+1

@jiangqidu
Copy link

有进展吗?都多久了

@GuoBinyong
Copy link

有进展吗

@silentcloud
Copy link

+1

1 similar comment
@mabel-xue
Copy link

+1

@jin-benben
Copy link

+2

@quicklearning123
Copy link

+3

@gs600981
Copy link

+4

@lihao6666
Copy link

+5

@xiaoyc-9364
Copy link

+6

@AugusQiu
Copy link

+7

@HeidaLay
Copy link

+8

@gezhicui
Copy link

+9

@GuoBinyong
Copy link

使用中间件 umi-request-progress可完美解决上传进度和下载进度的问题,步骤如下:

  1. 安装 npm install umi-request-progress;
  2. 使用:
//导入 umi-request
import request from 'umi-request';
//导入 umi-request-progress
import progressMiddleware from 'umi-request-progress';

// 注册内核中间件
request.use(progressMiddleware, { core: true });

// 上传文件
request("/file/upload",{
   ...otherOptions,
   //上传进度事件的回调函数
   onReqProgress:function( ev: ProgressEvent){
     console.log(ev)
   },
   //下载进度事件的回调函数
   onResProgress:function( ev: ProgressEvent){
     console.log(ev)
   },
});

@fandepeng1993
Copy link

+10

@cike8899
Copy link

+11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests