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.
ant-design-vue/components/modal/demo/locale.vue

64 lines
1.3 KiB

<docs>
---
order: 5
title:
zh-CN: 国际化
en-US: Internationalization
---
## zh-CN
设置 `okText` `cancelText` 以自定义按钮文字
## en-US
To customize the text of the buttons, you need to set `okText` and `cancelText` props.
</docs>
<template>
<div>
<a-button type="primary" @click="showModal">Modal</a-button>
<a-button @click="confirm">Confirm</a-button>
<a-modal v-model:open="open" title="Modal" ok-text="" cancel-text="" @ok="hideModal">
<p>Bla bla ...</p>
<p>Bla bla ...</p>
<p>Bla bla ...</p>
</a-modal>
</div>
</template>
<script lang="ts">
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { defineComponent, ref, createVNode } from 'vue';
import { Modal } from 'ant-design-vue';
export default defineComponent({
setup() {
const open = ref<boolean>(false);
const showModal = () => {
open.value = true;
};
const hideModal = () => {
open.value = false;
};
const confirm = () => {
Modal.confirm({
title: 'Confirm',
icon: createVNode(ExclamationCircleOutlined),
content: 'Bla bla ...',
okText: '确认',
cancelText: '取消',
});
};
return {
open,
showModal,
hideModal,
confirm,
};
},
});
</script>