import 'antd/dist/antd.css';
title
属性,并给其设置样式:import { Modal } from 'antd';
function MyModal() {
return (
确认删除?}
visible={true}
>
确定要删除吗?
);
}
以上代码中,我们在 title
属性中使用了一个 span
元素来自定义标题文本的样式,可以设置其字体加粗和字体大小。
.ant-modal-confirm .ant-modal-title {
font-weight: 600;
font-size: 16px;
}
通过上述 CSS 样式,我们可以为 Modal 组件中的 confirm 模态框设置标题样式,包括字体加粗和字体大小。