mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
refactor: cache the result of getLocale()
This commit is contained in:
parent
dc9dd43e39
commit
bbadcc34c1
@ -87,18 +87,19 @@ function createPicker(TheCalendar) {
|
|||||||
this.props.onChange(timeValue);
|
this.props.onChange(timeValue);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
const locale = this.getLocale();
|
||||||
// 以下两行代码
|
// 以下两行代码
|
||||||
// 给没有初始值的日期选择框提供本地化信息
|
// 给没有初始值的日期选择框提供本地化信息
|
||||||
// 否则会以周日开始排
|
// 否则会以周日开始排
|
||||||
let defaultCalendarValue = new GregorianCalendar(this.getLocale());
|
let defaultCalendarValue = new GregorianCalendar(locale);
|
||||||
defaultCalendarValue.setTime(Date.now());
|
defaultCalendarValue.setTime(Date.now());
|
||||||
|
|
||||||
const placeholder = ('placeholder' in this.props)
|
const placeholder = ('placeholder' in this.props)
|
||||||
? this.props.placeholder : this.getLocale().lang.placeholder;
|
? this.props.placeholder : locale.lang.placeholder;
|
||||||
const calendar = (
|
const calendar = (
|
||||||
<TheCalendar
|
<TheCalendar
|
||||||
disabledDate={this.props.disabledDate}
|
disabledDate={this.props.disabledDate}
|
||||||
locale={this.getLocale().lang}
|
locale={locale.lang}
|
||||||
defaultValue={defaultCalendarValue}
|
defaultValue={defaultCalendarValue}
|
||||||
dateInputPlaceholder={placeholder}
|
dateInputPlaceholder={placeholder}
|
||||||
showTime={this.props.showTime}
|
showTime={this.props.showTime}
|
||||||
|
Loading…
Reference in New Issue
Block a user