0

如题详述:

借助antdupload组件,实现多张上传。

可是选择多张文件,onChange事件里打印的fileList有时候是正常的张数,有时候又只有一张。在onChange里也动态设置了fileList,并且更新到upload的属性上。

根据官网的提示onChange事件只调用了一次。也是这样做的,但依然无效果,不知如何解?

<Dropdown overlay={getMenu(onShowEditor, this.onUploadInvoice, fileList)}>
    <Button type='primary' className={styles.filter_btn}>
        {APPEND_RECORD_TITLE}
    </Button>
</Dropdown>
const getMenu = (handleMenuClick, onUploadInvoice, fileList) => (
    <Menu onClick={handleMenuClick}>
        {/* <Menu.Item key="1">{SCANNING_NVOICE_TITLE}</Menu.Item> */}
        <Menu.Item key="2" style={{padding: 0}}>
            <span className={styles.upload_invoice_item} style={{}} onClick={(e) => e.stopPropagation()}>
                <Upload
                    action={completeURL(INVOICE_OCR_URL)}
                    showUploadList={false}
                    onChange={onUploadInvoice}
                    name="invoiceFile"
                    headers= {{'Login_Token': localStorageUtil.get('TOKEN') || ''}}
                    multiple={true}
                    fileList={fileList}
                >
                    {UPLOAD_TITLE}
                </Upload>
            </span>
        </Menu.Item>
        <Menu.Item key="3">{IMPORT_TITLE}</Menu.Item>
        <Menu.Item key="4">{HANDLE_INPUT_TITLE}</Menu.Item>
    </Menu>
);
onUploadInvoice (info) {
    let {file, fileList} = info;
    console.log(info);
    this.setState({
        isUploading: true,
        fileList
    });
}
fofo 304
2019-01-29 提问
1 个回答
0

showUploadList={false} 应该是ture吧?

撰写答案

推广链接