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

多个文件上传,如何更新进度条 #1285

Open
ezewu opened this issue Jan 22, 2024 · 0 comments
Open

多个文件上传,如何更新进度条 #1285

ezewu opened this issue Jan 22, 2024 · 0 comments

Comments

@ezewu
Copy link

ezewu commented Jan 22, 2024

  const callback = (taskList) => {
    $fetch("http://localhost:2800/task", { method: "post", body: taskList })
      .then((res) => {
        for (let i = 0; i < res.data.length; i++) {
          const ossData = res.data[i];
          const client = new OSS({
            region: ossData.regionId,
            accessKeyId: ossData.accessKeyId,
            accessKeySecret: ossData.accessKeySecret,
            stsToken: ossData.securityToken,
            bucket: ossData.bucketName,
          });



          //进度条数组

          updateFileList.value.push({
            name: ossData.path,
            fileName: taskList[i].fileName,
            fileSize: taskList[i].fileSize,
            progress: 0,
          });

          const progress = (progress, checkpoint) => {};

          client
            .multipartUpload(ossData.path, fileMap[ossData.fileId], {
              partSize: 1024 * 1024,
              progress,
            })
            .then((res) => {})
            .catch((e) => {});
        }
      })
      .catch((e) => {});
  };

多个文件如何更新updateFileList里面的 progress ,progress函数里面,无法获取到是第几个文件在上传

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