antd-vue - - - - - date-picker Chinese culture?

date-picker Chinese culture

1. Scene

After introducing the date-picker of antd, the effect is as follows:
insert image description here

what? Why is it not in Chinese? Didn't you encounter this when you used element before?

Check the official documents carefully and find this sentence:
Official address: [Internationalization Configuration]
insert image description here

2. Solutions

Because the whole project is not sure how many places are using this component, so I plan to wrap a layer of LocaleProvider group on the top-level vue

app.vue

<template>
  <div id="app">
    <a-config-provider :locale="zhCN">
      <router-view />
    </a-config-provider>
  </div>
</template>

<script>
import zhCN from "ant-design-vue/es/locale/zh_CN"; //汉化
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
dayjs.locale("zh-cn");

export default {
      
      
  setup() {
      
      
    return {
      
      
      zhCN
    };
  }
};
</script>

The effect is as follows:
insert image description here

Guess you like

Origin blog.csdn.net/Dark_programmer/article/details/130386587