为什么 React Modal 组件在设计时,点击关闭 Modal 按钮不在组件内部直接处理关闭逻辑,而是通过事件告知 外部组件 去关闭 Modal,而 Vue element-ui 中则可以在组件内部自行处理关闭 Dialog 逻辑https://design.alipay.com/dev...http://element.eleme.io/#/zh-...
1 回答
皈依舞
TA贡献1851条经验 获得超3个赞
import { Modal, Button } from 'antd';const confirm = Modal.confirm;function showConfirm() { confirm({ title: 'Do you want to delete these items?', content: 'When clicked the OK button, this dialog will be closed after 1 second', onOk() { return new Promise((resolve, reject) => { setTimeout(Math.random() > 0.5 ? resolve : reject, 1000); }).catch(() => console.log('Oops errors!')); }, onCancel() {}, }); } ReactDOM.render( <Button onClick={showConfirm}> Confirm </Button>, mountNode);
看清楚好吧
也是有的
添加回答
举报
0/150
提交
取消