UNPKG

cjd-parkball

Version:

> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用

38 lines (30 loc) 807 B
--- category: 2 title: 手动更新和移除 title_en: Manual to update destroy --- zh-CN 手动更新和关闭 `Modal.method` 方式创建的对话框。 en-US Manually updateing and destroying a modal from `Modal.method`. ````jsx import { Modal, Button } from 'parkball'; function countDown() { let secondsToGo = 5; const modal = Modal.success({ title: 'This is a notification message', content: `This modal will be destroyed after ${secondsToGo} second.`, }); setInterval(() => { secondsToGo -= 1; modal.update({ content: `This modal will be destroyed after ${secondsToGo} second.`, }); }, 1000); setTimeout(() => modal.destroy(), secondsToGo * 1000); } ReactDOM.render( <Button onClick={countDown}>Open modal to close in 5s</Button>, mountNode ); ````