如何在 antd 的 Notification 中使用换行符
How to use newline in Notification with antd
我尝试在我的通知说明中使用 \n
,但没有成功。我应该用什么来代替。
notification.warning({
message: 'Notification Title',
description:
'This is the content of the notification.\n This is the content of the notification. This is the content of the notification.',
});
很简单。只需使用 HTML 而不是字符串。
notification.warning({
message: 'Notification Title',
description: (
<>
This is the content of the notification.<br />
This is the content of the notification. This is the content of the notification.
</>
),
});
这里我给大家做了一个demo
我尝试在我的通知说明中使用 \n
,但没有成功。我应该用什么来代替。
notification.warning({
message: 'Notification Title',
description:
'This is the content of the notification.\n This is the content of the notification. This is the content of the notification.',
});
很简单。只需使用 HTML 而不是字符串。
notification.warning({
message: 'Notification Title',
description: (
<>
This is the content of the notification.<br />
This is the content of the notification. This is the content of the notification.
</>
),
});
这里我给大家做了一个demo