const onImportExcel = (file) => {
    return new Promise(async (resolve, reject) => {
 
      ...  //要执行的语句
        return reject(false);  //加上这个就会阻止默认上传
     
    });
  };
    <Upload
          name="file"
          className="avatar-uploader"
          showUploadList={false}
          beforeUpload={onImportExcel}
          accept=".xlsx,.xls,.xlt"
        >
          <Button type="primary" icon={<DownloadOutlined />}>
            导入
          </Button>
        </Upload>

  

posted on 2022-02-08 18:15  随心的博客  阅读(1795)  评论(0编辑  收藏  举报