Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

Ant Design Upload组件

文档:https://3x.ant.design/components/upload-cn/

取消图片删除按钮

<Upload
  showUploadList={{showRemoveIcon:false}}  //加上这句代码
  onChange={this.uploadStateChange}
  beforeUpload={this.beforeUpload}
  listType="picture-card"
  fileList={this.state.fileList}
  onRemove={this.handleRemove}
  onPreview={this.handlePreview}
  onSuccess={this.complate}
>

显示文件下载按钮

const props = {
  action: action,
  headers: { Authorization: token },
  data: { merchantId: merchant_id, fileType: type },
  // customRequest: this.customRequest,
  onChange: this.handleChange,
  // beforeUpload: this.beforeUpload,
  listType: 'picture',
  multiple: true,
  onRemove: this.onRemove,
  onDownload: this.onDownload,
  className: 'upload-list-inline',
  showUploadList: { showDownloadIcon: true }
  // defaultFileList: [...fileList],
};
{list.map((data, i) => (
  <div key={i} className={`${aStyle} ${bStyle} `}>
    <Upload
      key={i}
      {...props}
      defaultFileList={this.getDefaultUploadFile(type, data.doc_id)}
      // fileList={this.getDefaultUploadFile(type, data.doc_id)}
      // beforeUpload={file => this.beforeUpload(file, data.doc_id)}
      handleChange={file => this.handleChange(file, data.doc_id)}
    />
  </div>
))}
上一篇 Vue设置路由History mode模式,打包vue run build后访问404问题
下一篇 Webpack核心概念及入门
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。