mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-26 14:21:17 +08:00
docs: fix customize calendar example (#36356)
* docs: fix customize calendar example * test: changed calendar snapshot Co-authored-by: lico <lico@licoui-MacBookPro.local>
This commit is contained in:
parent
2e04982882
commit
e262ae8133
@ -3481,8 +3481,8 @@ exports[`renders ./components/calendar/demo/customize-header.md extend context c
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
aria-selected="false"
|
aria-selected="true"
|
||||||
class="ant-select-item ant-select-item-option year-item"
|
class="ant-select-item ant-select-item-option year-item ant-select-item-option-selected"
|
||||||
title="2016"
|
title="2016"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -41,16 +41,16 @@ const App: React.FC = () => {
|
|||||||
months.push(localeData.monthsShort(current));
|
months.push(localeData.monthsShort(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let index = start; index < end; index++) {
|
for (let i = start; i < end; i++) {
|
||||||
monthOptions.push(
|
monthOptions.push(
|
||||||
<Select.Option className="month-item" key={`${index}`}>
|
<Select.Option key={i} value={i} className="month-item">
|
||||||
{months[index]}
|
{months[i]}
|
||||||
</Select.Option>,
|
</Select.Option>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const month = value.month();
|
|
||||||
|
|
||||||
const year = value.year();
|
const year = value.year();
|
||||||
|
const month = value.month();
|
||||||
const options = [];
|
const options = [];
|
||||||
for (let i = year - 10; i < year + 10; i += 1) {
|
for (let i = year - 10; i < year + 10; i += 1) {
|
||||||
options.push(
|
options.push(
|
||||||
@ -78,11 +78,11 @@ const App: React.FC = () => {
|
|||||||
size="small"
|
size="small"
|
||||||
dropdownMatchSelectWidth={false}
|
dropdownMatchSelectWidth={false}
|
||||||
className="my-year-select"
|
className="my-year-select"
|
||||||
|
value={year}
|
||||||
onChange={newYear => {
|
onChange={newYear => {
|
||||||
const now = value.clone().year(Number(newYear));
|
const now = value.clone().year(newYear);
|
||||||
onChange(now);
|
onChange(now);
|
||||||
}}
|
}}
|
||||||
value={String(year)}
|
|
||||||
>
|
>
|
||||||
{options}
|
{options}
|
||||||
</Select>
|
</Select>
|
||||||
@ -91,11 +91,10 @@ const App: React.FC = () => {
|
|||||||
<Select
|
<Select
|
||||||
size="small"
|
size="small"
|
||||||
dropdownMatchSelectWidth={false}
|
dropdownMatchSelectWidth={false}
|
||||||
value={String(month)}
|
value={month}
|
||||||
onChange={selectedMonth => {
|
onChange={newMonth => {
|
||||||
const newValue = value.clone();
|
const now = value.clone().month(newMonth);
|
||||||
newValue.month(parseInt(selectedMonth, 10));
|
onChange(now);
|
||||||
onChange(newValue);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{monthOptions}
|
{monthOptions}
|
||||||
|
Loading…
Reference in New Issue
Block a user