2015-10-23 17:57:02 +08:00
|
|
|
|
# 国际化
|
|
|
|
|
|
2015-12-25 01:21:03 +08:00
|
|
|
|
- order: 10
|
2015-10-23 17:57:02 +08:00
|
|
|
|
|
2016-04-25 19:27:02 +08:00
|
|
|
|
通过 `locale` 配置时区、语言等, 默认支持 `en_US`,`zh_CN`。
|
2015-10-23 17:57:02 +08:00
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
````jsx
|
2015-12-10 16:12:10 +08:00
|
|
|
|
import { DatePicker } from 'antd';
|
|
|
|
|
import enUS from 'antd/lib/date-picker/locale/en_US';
|
2015-10-23 17:57:02 +08:00
|
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
|
const App = React.createClass({
|
2015-10-23 17:57:02 +08:00
|
|
|
|
render() {
|
2016-04-25 19:27:02 +08:00
|
|
|
|
const customLocale = {
|
|
|
|
|
timezoneOffset: 0 * 60,
|
|
|
|
|
firstDayOfWeek: 0,
|
|
|
|
|
minimalDaysInFirstWeek: 1,
|
|
|
|
|
};
|
|
|
|
|
return <DatePicker locale={{ ...enUS, ...customLocale }} />;
|
2015-10-23 17:57:02 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
|
ReactDOM.render(<App />, mountNode);
|
2015-10-23 17:57:02 +08:00
|
|
|
|
````
|