You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
656 B

---
order: 1
title: 自动关闭的延时
---
自定义通知框自动关闭的延时,默认`4.5s`,取消自动关闭只要将该值设为 `0` 即可。
````jsx
import { Button, notification } from 'antd';
const openNotification = function () {
const args = {
message: '这是标题',
description: '我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭',
duration: 0,
};
notification.open(args);
};
9 years ago
ReactDOM.render(
<Button type="primary" onClick={openNotification}>打开通知提醒框</Button>
, mountNode);
9 years ago
````