/* eslint-disable no-console */ import '../assets/index.less' import Notification from '../index' let notification = null Notification.newInstance({ maxCount: 10, }, (n) => { notification = n }) function simpleFn () { notification.notice({ content: (h) => { return simple show }, onClose () { console.log('simple close') }, }) } function durationFn () { notification.notice({ content: (h) => { return can not close... }, duration: null, }) } function closableFn () { notification.notice({ content: (h) => { return closable }, duration: null, onClose () { console.log('closable close') }, onClick () { console.log('clicked!!!') }, closable: true, }) } function close (key) { notification.removeNotice(key) } function manualClose () { const key = Date.now() notification.notice({ content: (h) => { return

click below button to close

}, key, duration: null, }) } let counter = 0 let intervalKey function updatableFn () { if (counter !== 0) { return } const key = 'updatable-notification' const initialProps = { content: `Timer: ${counter}s`, key, duration: null, closable: true, onClose () { clearInterval(intervalKey) counter = 0 }, } notification.notice(initialProps) intervalKey = setInterval(() => { notification.notice({ ...initialProps, content: `Timer: ${++counter}s` }) }, 1000) } export default { render () { return (
) }, }