添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steps to reproduce

如链接 https://codesandbox.io/s/antd-reproduction-template-forked-rdnzp3

import React from "react";
import { useState } from "react";
import { createRoot } from "react-dom/client";
import "antd/dist/reset.css";
import "./index.css";
import Dragger from "antd/es/upload/Dragger";
const App = () => {
  const [fileList, setFileList] = useState([]);
  const props = {
    name: "file",
    onChange(info) {
      setFileList(info.fileList);
    customRequest: async (options) => {
      const formData = new FormData();
      formData.append("file", options.file);
      try {
        const response = await req.post("/uploadTmpReport", formData, {
          headers: { "Content-Type": "multipart/form-data" },
          timeout: 0,
          onUploadProgress: (progressEvent) => {
            if (progressEvent.total) {
              const percent = Math.round(
                (progressEvent.loaded * 100) / progressEvent.total
              options.onProgress({ percent }, options.file);
              if (percent === 100) {
                options.onSuccess(); 
            } else {
              options.onProgress(
                { loaded: progressEvent.loaded },
                options.file
        const data = response.data;
        if (data.code != 200) {
          options.onError("上传失败", options.fileList);
      } catch (error) {
        options.onError("上传失败", options.fileList);
    showUploadList: { showRemoveIcon: true },
    disabled: fileList.length == 1
  return (
    <div className="App">
      <Dragger {...props}>
        <p className="ant-upload-text">点击或拖拽上传</p>
      </Dragger>
const root = createRoot(document.getElementById("root"));
root.render(<App />);

What is expected?

使用disabled属性时只禁用上传按钮,而不禁用文件列表的删除按钮,禁用文件列表的删除按钮应该通过showUploadList: { showRemoveIcon: false}来实现

What is actually happening?

使用disable=false属性后,使用showRemoveIcon=true仍无法显示删除图标

Environment

https://codesandbox.io/s/antd-reproduction-template-forked-sjkcly

使用disable=false属性后,使用showRemoveIcon=true仍无法显示删除图标

和你的描述貌似不太一致。

Hello @fasnow. Please provide a online reproduction by forking codesandbox of [email protected] or [email protected], or provide a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @fasnow, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 [email protected][email protected] 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

https://codesandbox.io/s/antd-reproduction-template-forked-sjkcly

使用disable=false属性后,使用showRemoveIcon=true仍无法显示删除图标

和你的描述貌似不太一致。

disable得通过一个变量控制,只允许上传一个文件,不管失败与否,计数器为1:disable=true,为0:disable=false,就像我用了fileList.length == 1来控制一样,disable为false当然没问题的,但是disable为true时,我想的是禁止上传,但是可以删除已有的

Upload Dragger使用disable=false属性后,使用showRemoveIcon=true仍无法显示删除图标 Upload Dragger使用disable=true属性后,使用showRemoveIcon=true仍无法显示删除图标 Nov 9, 2023