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

upload 组件 axios自定义请求,进度条配置会导致无法发起请求 #395

Open
1 task
501956430 opened this issue Aug 25, 2024 · 1 comment
Open
1 task

Comments

@501956430
Copy link

Basic Info

axios.post('/upload',formData, {
      headers: { 'Content-Type': 'multipart/form-data' },
      withCredentials: true,
      onUploadProgress: (progressEvent) => {
        console.log(progressEvent);
        const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
        onProgress(percentCompleted, progressEvent);
      },
    })
      .then((res) => {
        onSuccess('上传成功');
        console.log(res);
      })
      .catch((err) => {
        onError('上传失败');
      });

添加了onUploadProgress 请求就不执行。

@501956430
Copy link
Author

有没哪位大侠可以帮帮我

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

1 participant