You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { Modal } from 'antd'
|
|
|
|
const confirm = Modal.confirm
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
showConfirm() {
|
|
|
|
confirm({
|
|
|
|
title: 'Do you Want to delete these items?',
|
|
|
|
content: 'Some descriptions',
|
|
|
|
onOk() {
|
|
|
|
console.log('OK');
|
|
|
|
},
|
|
|
|
onCancel() {
|
|
|
|
console.log('Cancel');
|
|
|
|
},
|
|
|
|
class: 'test',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showDeleteConfirm() {
|
|
|
|
confirm({
|
|
|
|
title: 'Are you sure delete this task?',
|
|
|
|
content: 'Some descriptions',
|
|
|
|
okText: 'Yes',
|
|
|
|
okType: 'danger',
|
|
|
|
cancelText: 'No',
|
|
|
|
onOk() {
|
|
|
|
console.log('OK');
|
|
|
|
},
|
|
|
|
onCancel() {
|
|
|
|
console.log('Cancel');
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|
|
|
|
|