我想在 antd 中上传时自定义上传组件中的“上传”文本。但是我在 antd doc 中找不到任何东西来帮助我。这是文档:https : //ant.design/components/upload/
如何在antd的上传组件中更改上传文本?
IT技术
reactjs
antd
2021-05-23 02:07:15
1个回答
要更改 的位置content
,您需要自定义top
和left
。我也更改了其他元素的 CSS 属性(加号图标的红色,另一张卡片的上传文本)。您可以根据需要更改它们。这是一个快速演示。
/* plus + icon*/
.ant-upload-select-picture-card i {
font-size: 32px;
color: red;
}
/* Upload text*/
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: red;
}
/* Uploading... text*/
.ant-upload-list-item-info
> span
> div[class="ant-upload-list-item-uploading-text"] {
visibility: hidden;
}
/* you need to customise top and left css attribute */
.ant-upload-list-item-info
> span
> div[class="ant-upload-list-item-uploading-text"]:after {
content: "Wait ?";
visibility: visible;
display: block;
position: absolute;
padding: 1px;
top: 10px;
left: 10px;
}
其它你可能感兴趣的问题