简介
使用antd3 和 antd4 的datepicker时, 会出现其他区域中文, 月份和星期为英文的情况。官网的配置都试过了。
解决方法(仅限antd4, antd3 moment版本未知)
- 安装特定版本moment :
yarn add [email protected]
- 覆盖node_modules/moment - > node_modules/antd/node_modules/moment
解决
猜想
- 可能是antd在安装时会拷贝(or 软链接)一份moment到它的子目录; 或者直接装了个最新的。 这样的话, 你单纯卸载外层的moment对它毫无影响, 或者你保证安装顺序如下:
- yarn add [email protected]
- yarn add [email protected]
当然嘛,手动覆盖moment最直接。