fix: datepicker header error #2488

pull/1775/head
tanjinzhou 2020-07-03 15:19:19 +08:00
parent 71bf529688
commit 535fb55ac9
3 changed files with 12 additions and 3 deletions

View File

@ -174,7 +174,7 @@ const CalendarHeader = {
panel = ( panel = (
<YearPanel <YearPanel
locale={locale} locale={locale}
defaultValue={value} value={value}
rootPrefixCls={prefixCls} rootPrefixCls={prefixCls}
onSelect={this.onYearSelect} onSelect={this.onYearSelect}
onDecadePanelShow={this.showDecadePanel} onDecadePanelShow={this.showDecadePanel}
@ -186,7 +186,7 @@ const CalendarHeader = {
panel = ( panel = (
<DecadePanel <DecadePanel
locale={locale} locale={locale}
defaultValue={value} value={value}
rootPrefixCls={prefixCls} rootPrefixCls={prefixCls}
onSelect={this.onDecadeSelect} onSelect={this.onDecadeSelect}
renderFooter={renderFooter} renderFooter={renderFooter}

View File

@ -35,7 +35,11 @@ export default {
sValue: this.value || this.defaultValue, sValue: this.value || this.defaultValue,
}; };
}, },
watch: {
value(val) {
this.sValue = val;
},
},
render() { render() {
const value = this.sValue; const value = this.sValue;
const { locale, renderFooter } = this.$props; const { locale, renderFooter } = this.$props;

View File

@ -36,6 +36,11 @@ export default {
sValue: this.value || this.defaultValue, sValue: this.value || this.defaultValue,
}; };
}, },
watch: {
value(val) {
this.sValue = val;
},
},
methods: { methods: {
years() { years() {
const value = this.sValue; const value = this.sValue;