61 lines
1.0 KiB
Markdown
61 lines
1.0 KiB
Markdown
|
|
||
|
<cn>
|
||
|
#### 国际化
|
||
|
设置 `okText` 与 `cancelText` 以自定义按钮文字。
|
||
|
</cn>
|
||
|
|
||
|
<us>
|
||
|
#### Internationalization
|
||
|
To customize the text of the buttons, you need to set `okText` and `cancelText` props.
|
||
|
</us>
|
||
|
|
||
|
```html
|
||
|
<template>
|
||
|
<div>
|
||
|
<a-button type="primary" @click="showModal">Modal</a-button>
|
||
|
<a-modal
|
||
|
title="Modal"
|
||
|
v-model="visible"
|
||
|
@ok="hideModal"
|
||
|
okText="确认"
|
||
|
cancelText="取消"
|
||
|
>
|
||
|
<p>Bla bla ...</p>
|
||
|
<p>Bla bla ...</p>
|
||
|
<p>Bla bla ...</p>
|
||
|
</a-modal>
|
||
|
<br />
|
||
|
<br />
|
||
|
<a-button @click="confirm">Confirm</a-button>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
|
import { Modal } from 'antd'
|
||
|
const confirm = Modal.confirm
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
visible: false,
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
showModal() {
|
||
|
this.visible = true
|
||
|
},
|
||
|
hideModal() {
|
||
|
this.visible = false
|
||
|
},
|
||
|
confirm() {
|
||
|
confirm({
|
||
|
title: 'Confirm',
|
||
|
content: 'Bla bla ...',
|
||
|
okText: '确认',
|
||
|
cancelText: '取消',
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
```
|
||
|
|