Ant-design-vue: LocaleProvider 国际化引入名称和文档不一样,且包裹路由后, DatePicker并未汉化

Created on 28 Oct 2020  ·  4Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-beta.10

Environment

Vue3.0 typescript

Reproduction link

Edit on CodeSandbox

Steps to reproduce

在App.vue 中使用 包裹路由,DatePicker并未汉化

What is expected?

被包裹的组件汉化

What is actually happening?

被包裹的组件并未被汉化,
且提示Could not find a declaration file for module 'ant-design-vue/es/date-picker/locale/zh_CN'. 'E:/svn/*/app/node_modules/ant-design-vue/es/date-picker/locale/zh_CN.js' implicitly has an 'any' type.

<template>
  <a-config-provider :locale="locale">
    <router-view />
  </a-config-provider>
</template>

Most helpful comment

不是 'ant-design-vue/es/date-picker/locale/zh_CN' 这个路径,请重新确认一下

https://antdv.com/components/config-provider-cn/#components-config-provider-demo-locale

你给的这个链接,选择示例的中文选项后,那几个日期表单组件也还有英文(周一到周日,月份没有国际化),和日历组件的效果不一样

All 4 comments

不是 'ant-design-vue/es/date-picker/locale/zh_CN' 这个路径,请重新确认一下

https://antdv.com/components/config-provider-cn/#components-config-provider-demo-locale

add

import 'moment/locale/zh-cn';

moment.locale('zh-cn');

不是 'ant-design-vue/es/date-picker/locale/zh_CN' 这个路径,请重新确认一下

https://antdv.com/components/config-provider-cn/#components-config-provider-demo-locale

你给的这个链接,选择示例的中文选项后,那几个日期表单组件也还有英文(周一到周日,月份没有国际化),和日历组件的效果不一样

不是 'ant-design-vue/es/date-picker/locale/zh_CN' 这个路径,请重新确认一下
https://antdv.com/components/config-provider-cn/#components-config-provider-demo-locale

你给的这个链接,选择示例的中文选项后,那几个日期表单组件也还有英文(周一到周日,月份没有国际化),和日历组件的效果不一样

改成这样就可以了

<template>
  <a-config-provider :locale="locale">
    <router-view />
  </a-config-provider>
</template>
import { Options, Vue } from 'vue-class-component'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import moment from 'moment'
moment.locale('zh-cn')

/**@Options({
  provide() {
    return {
      locale: zhCN,
    }
  },
*/
})
export default class App extends Vue {
  public locale = zhCN
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kdashsoul picture kdashsoul  ·  5Comments

oleksii-shaposhnikov picture oleksii-shaposhnikov  ·  4Comments

fengqinglingyu picture fengqinglingyu  ·  5Comments

AndesLai picture AndesLai  ·  4Comments

ZhaoAndQian picture ZhaoAndQian  ·  3Comments