如何在 antd 通知中使用换行符

Bat*_*lay 5 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.',
  });
Run Code Online (Sandbox Code Playgroud)

Sur*_*iya 8

这很简单。只需使用 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.
      </>
  ),  
});
Run Code Online (Sandbox Code Playgroud)

这里我给大家做了一个demo 。