-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
vue 3.0.2
ant-design-vue 2.0.0-beta.13
moment 2.29.1
Environment
windows 10
chrome
vue 3.0.2
ant-design-vue 2.0.0-beta.13
moment 2.29.1
Reproduction link
官方链接
https://2x.antdv.com/components/calendar-cn/
Steps to reproduce
App.vue
<template>
<!-- <router-view /> -->
<a-config-provider :locale="locale">
<router-view />
</a-config-provider>
</template>
<script>
import locale from "ant-design-vue/es/locale/zh_CN";
import moment from "moment";
import "moment/locale/zh-cn";
moment.locale("zh-cn");
export default {
name: "App",
data() {
return {
locale,
moment,
};
},
};
</script>Calendar.vue
<template>
<a-row>
<a-col :span="12">
<div
:style="{
border: '1px solid #d9d9d9',
borderRadius: '4px',
marginLeft: '12px',
}"
>
<a-calendar
v-model:value="value"
:fullscreen="false"
@panelChange="onPanelChange"
/>
</div>
</a-col>
<a-col :span="12"></a-col>
</a-row>
</template>
<script>
export default {
name: "Calendar",
data() {
return {
value: "",
};
},
methods: {
onPanelChange(value, mode) {
console.log(value, mode);
},
},
};
</script>What is expected?
全局汉化日历组件
What is actually happening?
实际报错
zh-cn.js:11 Uncaught TypeError: Cannot read property 'moment' of undefined
at zh-cn.js:11
at zh-cn.js:12
如果是这样的话
<template>
<!-- <router-view /> -->
<a-config-provider :locale="locale">
<router-view />
</a-config-provider>
</template>
<script>
import locale from "ant-design-vue/es/locale/zh_CN";
// import moment from "moment";
// import "moment/locale/zh-cn";
// moment.locale("zh-cn");
export default {
name: "App",
data() {
return {
locale,
// moment,
};
},
};
</script>
确实不会报错,但是只有部分被汉化,就像官方教程一样
只有头部的年月被汉化,日期区域无法汉化