/** * Created by hao.cheng on 2017/4/25. */ import React, { Component } from 'react'; import { Row, Col, Card, Button, notification, Select } from 'antd'; import BreadcrumbCustom from '../widget/BreadcrumbCustom'; import { IconType, ConfigProps } from 'antd/lib/notification'; import { SmileOutlined } from '@ant-design/icons'; const { Option } = Select; const options = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']; class Notifications extends Component { 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.', }); }; openNotification2 = () => { const args = { message: 'Notification Title', description: 'I will never close automatically. I will be close automatically. I will never close automatically.', duration: 0, }; notification.open(args); }; openNotificationWithIcon = (type: IconType) => { notification[type]({ 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.', }); }; openNotification3 = () => { const key = `open${Date.now()}`; const btnClick = function () { // to hide notification box notification.close(key); }; const btn = ( ); notification.open({ message: 'Notification Title', description: 'A function will be be called after the notification is closed (automatically after the "duration" time of manually).', btn, key, onClose: this.close, }); }; close = () => { console.log( 'Notification was closed. Either the close button was clicked or duration time elapsed.' ); }; openNotification4 = () => { 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.', icon: , }); }; render() { return (
); } } export default Notifications;