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

81 lines
1.6 KiB
Markdown
Raw Normal View History

2018-03-06 14:53:32 +00:00
<cn>
#### 确认对话框
使用 `confirm()` 可以快捷地弹出确认框。
</cn>
<us>
#### Confirmation modal dialog
To use `confirm()` to popup a confirmation modal dialog.
</us>
```html
<template>
<div>
<a-button @click="showConfirm">
Confirm
</a-button>
<a-button @click="showDeleteConfirm" type="dashed">
Delete
</a-button>
<a-button @click="showPropsConfirm" type="dashed">
With extra props
</a-button>
2018-03-06 14:53:32 +00:00
</div>
</template>
<script>
export default {
methods: {
showConfirm() {
2018-04-08 13:17:20 +00:00
this.$confirm({
2018-03-06 14:53:32 +00:00
title: 'Do you Want to delete these items?',
content: 'Some descriptions',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
2018-03-07 13:36:15 +00:00
class: 'test',
2018-03-06 14:53:32 +00:00
});
},
showDeleteConfirm() {
2018-04-08 13:17:20 +00:00
this.$confirm({
2018-03-06 14:53:32 +00:00
title: 'Are you sure delete this task?',
content: 'Some descriptions',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
},
showPropsConfirm() {
this.$confirm({
title: 'Are you sure delete this task?',
content: 'Some descriptions',
okText: 'Yes',
okType: 'danger',
okButtonProps: {
props: {disabled: true},
},
cancelText: 'No',
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
}
2018-03-06 14:53:32 +00:00
}
}
</script>
```