-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): support week multiple
- Loading branch information
1 parent
51d7123
commit 647a3ac
Showing
4 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
import React, { useState } from 'react'; | ||
import { DatePicker } from 'tdesign-react'; | ||
import { DatePicker, Space } from 'tdesign-react'; | ||
import type { DatePickerProps, DateMultipleValue } from 'tdesign-react'; | ||
|
||
export default function YearDatePicker() { | ||
const [defaultValue, setDefaultValue] = useState<DateMultipleValue>(['2000-01-04', '2000-01-03', '2000-01-05']); | ||
const [defaultValue, setDefaultValue] = useState<DateMultipleValue>(['2000-01-04', '2000-01-03', '2000-01-10']); | ||
|
||
const handleChange: DatePickerProps['onChange'] = (value: DateMultipleValue, context) => { | ||
console.log('onChange:', value, context); | ||
setDefaultValue(value); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Space direction="vertical"> | ||
{/* <DatePicker | ||
value={defaultValue} | ||
placeholder="可清除、可输入的日期选择器" | ||
onChange={handleChange} | ||
clearable | ||
multiple | ||
/> */} | ||
<DatePicker | ||
value={defaultValue} | ||
placeholder="可清除、可输入的日期选择器" | ||
onChange={handleChange} | ||
clearable | ||
multiple | ||
mode="week" | ||
/> | ||
</div> | ||
{/* <DatePicker | ||
value={defaultValue} | ||
placeholder="可清除、可输入的日期选择器" | ||
onChange={handleChange} | ||
clearable | ||
multiple | ||
mode="year" | ||
/> */} | ||
</Space> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters