mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
2bced36f0c
* Tweak button padding
* upgrade input and button size
* update form controls size
* update components size
* Add lemon color and update rate color
* Add new icons
* update layout style
* breadcrumb and dropdown
* update menu arrow width
* update layout and menu
* update steps
* fix var name
* update cascasder style
* Update DatePicker
* update InputNumber and Mention
* radio and switch
* select and transfer
* TimePicker & Upload
* more components
* calendar and list
* Tree Timeline Popover Tag
* divider modal popover
* update search input
* update card style
* update switch disabled opacity
* update shoadow and mask
* Add v2-compatible-reset.less
* Fix undefined className
* update snahshotssssssssssssssssss 👻
1.8 KiB
1.8 KiB
order | title | ||||
---|---|---|---|---|---|
2 |
|
zh-CN
更复杂的例子,自定义了页脚的按钮,点击提交后进入 loading 状态,完成后关闭。
不需要默认确定取消按钮时,你可以把 footer
设为 null
。
en-US
A more complex example which define a customized footer button bar, the dialog will change to loading state after clicking submit button, when the loading is over, the modal dialog will be closed.
You could set footer
to null
if you don't need default footer buttons.
import { Modal, Button } from 'antd';
class App extends React.Component {
state = {
loading: false,
visible: false,
}
showModal = () => {
this.setState({
visible: true,
});
}
handleOk = () => {
this.setState({ loading: true });
setTimeout(() => {
this.setState({ loading: false, visible: false });
}, 3000);
}
handleCancel = () => {
this.setState({ visible: false });
}
render() {
const { visible, loading } = this.state;
return (
<div>
<Button type="primary" onClick={this.showModal}>
Open
</Button>
<Modal
visible={visible}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" onClick={this.handleCancel}>Return</Button>,
<Button key="submit" type="primary" loading={loading} onClick={this.handleOk}>
Submit
</Button>,
]}
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
</div>
);
}
}
ReactDOM.render(<App />, mountNode);