antdesign 解决Upload文件上传转圈问题

    upload(item) {
        let fileList = [];
        this.createForm.paths = ‘‘;
        const formData = new FormData();
        formData.append(‘file‘, item.file);
        formData.append(‘paramCode‘, ‘data_source‘);
        uploadDictionary(formData).then((res) => {
            if (res.code === 200 && res.data) {
                this.createForm.paths = res.data.join();
                fileList.push({ name: item.file.name });
                message.success(‘上传成功‘);
                item.onSuccess();  // 上传成功后结束文件上传转圈状态
            } else {
                message.error(res.message || ‘上传失败‘);
                item.onError();  // 返回报错
            }
            this.setState({
                fileList
            });
        });
    }
<Upload.Dragger
      beforeUpload={() => beforeUpload()}
      customRequest={() => upload()}
      accept={‘.xls‘}
 >
     <p className="ant-upload-drag-icon">
          <CloudUploadOutlined />
     </p>
     <p className="ant-upload-text">将文件拖到此处,或点击上传</p>
 </Upload.Dragger>

 

antdesign 解决Upload文件上传转圈问题

上一篇:Android版APM地面站,支持直连和数传台连接


下一篇:PHP分片上传文件到又拍云对象存储