ant-design-vue/components/modal/demo/footer.md

62 lines
1.6 KiB
Markdown
Raw Normal View History

2018-03-07 13:36:15 +00:00
<cn>
#### 自定义页脚
更复杂的例子,自定义了页脚的按钮,点击提交后进入 loading 状态,完成后关闭。
不需要默认确定取消按钮时,你可以把 `footer` 设为 `null`
</cn>
<us>
#### Customized Footer
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.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-03-07 13:36:15 +00:00
<template>
<div>
<a-button type="primary" @click="showModal">
Open Modal with customized footer
2018-03-07 13:36:15 +00:00
</a-button>
2019-09-28 12:45:07 +00:00
<a-modal v-model="visible" title="Title" onOk="handleOk">
2018-03-07 13:36:15 +00:00
<template slot="footer">
<a-button key="back" @click="handleCancel">Return</a-button>
<a-button key="submit" type="primary" :loading="loading" @click="handleOk">
Submit
</a-button>
</template>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</a-modal>
</div>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
loading: false,
visible: false,
};
2018-03-07 13:36:15 +00:00
},
2019-09-28 12:45:07 +00:00
methods: {
showModal() {
this.visible = true;
},
handleOk(e) {
this.loading = true;
setTimeout(() => {
this.visible = false;
this.loading = false;
}, 3000);
},
handleCancel(e) {
2018-03-07 13:36:15 +00:00
this.visible = false;
2019-09-28 12:45:07 +00:00
},
2018-03-07 13:36:15 +00:00
},
2019-09-28 12:45:07 +00:00
};
2018-03-07 13:36:15 +00:00
</script>
```