react-upload

 const options = {
            baseUrl: 'https://dev2.zhishinet.com/api/zcommon/v1/sec/resource',
            param: {},
            chooseAndUpload: true,
            paramAddToField: {purpose: 'save'},
            method: 'POST',
            accept: 'xls,xlsx',
            requestHeaders: {
                'Authorization': (window as GlobalDefinitions).authorization,
            },
            chooseFile: function (files: any) {
                console.log('you choose', files, files[0].name)
            },
            beforeUpload: function (files: any, mill: any) {
                console.log('you beforeUpload ', files);
                if (files[0].size < 1024 * 1024 * 20) {
                    files[0].mill = mill
                    return true;
                } else {
                    return false;
                }
                ;
            },
            doUpload: function (files: any, mill: any) {
                console.log('you doUpload ')
                console.log('you just uploaded', typeof files == 'string' ? files : files[0].name)
            },
            uploadSuccess: function (resp: any) {
                console.log('you just uploadSuccess  ', resp)
                message.success('This is a message of uploadSuccess ');
                selfThis.verifyFileExcel(resp.resourceId);
            },
            uploadError: function (err: any) {
                message.error('This is a message of uploadError');
            },
            uploadFail: function (resp: any) {
                message.warning('This is message of uploadFail ');
            }
        };

你可能感兴趣的:(react)