简体   繁体   中英

Custom loader component in Upload Ant Design instead progress bar

I need to insert a Spin loader instead of a progress bar and text while loading media onto the server.

Upload the Ant component of version 3.x

Here's a link to the docs https://ant.design/components/upload/#API I did not find a way to solve this problem. Any ideas how to do this, please help

I was able to do something like this:

const [isUploading, setIsUploading] = React.useState<number | null>(null);

<Upload 
    action={`actionURL`} 
    beforeUpload={()=>{setIsUploading(true);return true;}}
    onChange={x=>{
        if (x.file.status == 'done') {
            setIsUploading(false);
        }
    }}
>
    <Button 
        disabled={!_.isNil(currentlyUploadYear)} 
        icon={<UploadOutlined />} 
        loading={isLoading} >{item}
    </Button>
</Upload>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM