const { Modal, Button } = antd;
class App extends React.Component {
state = {
loading: false,
visible: false,
}
render() {
const { visible, loading } = this.state;
return (
<div>
<Modal
visible={visible}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
// 定義右下角 按鈕的地方 可根據需要使用 一個或者 2個按鈕
<Button key="back" onClick={this.handleCancel}></Button>,
<Button key="submit" type="primary" loading={loading} onClick={this.handleOk}>
Submit
</Button>, ]}
>
</Modal>
</div>
);
}
}
ReactDOM.render(<App />, mountNode);複製程式碼
或者是使用Modal.info方法等 提示方式
Modal.info({
title: 'This is a notification message',
content: (
<div>
<p>some messages...some messages...</p>
<p>some messages...some messages...</p>
</div>
),
onOk() {},
});
複製程式碼