https://www.antdv.com/components/date-picker-cnhttps://www.antdv.com/components/config-provider-cn/https://www.antdv.com/docs/vue/i18n-cn
<script setup>
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
// 设置 dayjs 的语言为中文
dayjs.locale('zh-cn');
// 定义响应式数据
const locale = zhCN;
</script>
<template style="width: 100%;height: 100%;margin: 0;padding: 0">
<a-config-provider :locale="locale">
<router-view style="width: 100%;height: 100%"></router-view>
</a-config-provider>
</template>
<style scoped>
</style>
下面是官网上的代码,非日期组件什么的可以参考下面代码
<template>
<a-config-provider :getPopupContainer="getPopupContainer">
<app />
</a-config-provider>
</template>
<script>
export default {
methods: {
getPopupContainer(el, dialogContext) {
if (dialogContext) {
return dialogContext.getDialogWrap();
} else {
return document.body;
}
},
},
};
</script>