ant-d上传图片文件时如何为removeFile添加PopConfirm

How to add PopConfirm for removeFile an image file in ant-d upload

我正在使用 Ant-d Upload 通过本地系统上传文件,然后单击文件预览图像上的删除图标,图像文件是 deleted.I 想添加弹出确认,所以我尝试了在 onRemovefunction 中添加确认作为承诺,但它不是 working.It 在浏览器中显示警报。

 onGalleryFileRemove = (file)=>{
 return new Promise((resolve, reject) => {
  confirm({
    title: 'are you sure to remove this file?',
      onOk: () => {
        resolve(true)
      },
  })
    const index = this.state.galleryFile.indexOf(file);
    const deletedGalleryFiles = this.state.deletedGalleryFiles;
    deletedGalleryFiles.push(this.state.galleryFile[index].uid);
    const newFileList = this.state.galleryFile.slice();
        newFileList.splice(index, 1);
            this.setState({
                galleryFile:newFileList,
                deletedGalleryFiles,
                previewVisible:false 
            })
    false    
    })
}
<Upload
    listType="picture-card"
    beforeUpload={this.beforeFileUpload}
    fileList={this.state.galleryFile}
    onPreview={this.handlePreview}
    onChange={this.handleGalleryFileChange}
    onRemove={this.onGalleryFileRemove}
>
  {this.state.galleryFile.length >= 6 ? null : uploadGalleryButton}
</Upload>
<Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
  <img alt="previewImage" style={{ width: '100%' }} src={this.state.previewImage} />
</Modal>

幸运的是,我得到了 this.I 的解决方案知道有人可能会在这个庞大的社区中帮助我我认为它可能对任何人都有用

 onGalleryFileRemove = (file)=>{
   const {confirm} = Modal
   return new Promise((resolve, reject) => {
    confirm({
      title: 'Are you sure you want to Delete ?',
      onOk: () => {
        resolve(true)
           <!---- onRemoveFunctionality here ---->
      },
      onCancel: () =>{
         reject(true)
      }
    })
   })
 }