亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

React 組件設計問題

React 組件設計問題

侃侃無極 2018-08-23 21:15:42
為什么 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);

看清楚好吧 
也是有的


查看完整回答
反對 回復 2018-08-26
  • 1 回答
  • 0 關注
  • 809 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號