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

fix: data file 与 beforeUpload 返回的 file不一致 #417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fourcels
Copy link

No description provided.

@vercel
Copy link

vercel bot commented Jun 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
upload ✅ Ready (Inspect) Visit Preview Jun 13, 2022 at 9:05AM (UTC)

@yoyo837
Copy link
Member

yoyo837 commented Jun 13, 2022

用例来一个覆盖一下。

@fourcels
Copy link
Author

<Upload
    beforeUpload={(file) => {
        return new Promise((resolve, reject) => {
            new Compressor(file, {
                maxWidth: 1500,
                maxHeight: 1500,
                // The compression process is asynchronous,
                // which means you have to access the `result` in the `success` hook function.
                success(result) {
                    resolve(result)
                },
                error(err) {
                    reject(err.message);
                },
            });
        })
    }}
    data={(file) => {
     //  获取压缩后的file

  }}
   
>
    <Button icon={<UploadOutlined />}>上传图片</Button>
</Upload>

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

Successfully merging this pull request may close these issues.

2 participants