【发布时间】:2020-03-26 21:05:17
【问题描述】:
我目前在尝试为 Ant Design 的通知模块使用自定义样式时遇到问题。这是我的代码
import React from "react";
import ReactDOM from "react-dom";
import "antd/dist/antd.css";
import "./index.css";
import "./notification.less";
import { Button, notification } from "antd";
const openNotification = () => {
notification.open({
message: "Notification Title",
description:
"This is the content of the notification. This is the content of the notification. This is the
content of the notification.",
className: "notification-type-info"
});
};
ReactDOM.render(
<Button type="primary" onClick={openNotification}>
Open the notification box
</Button>,
document.getElementById("container")
);
这是我的 notification.less 文件中的内容
.notification-type-info {
width: 200px;
background-color: #1890ff;
}
这是我测试代码的地方 https://codesandbox.io/s/customized-style-ant-design-demo-n0yh7
我做错了什么?
【问题讨论】: