-
Notifications
You must be signed in to change notification settings - Fork 326
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 multiple api
- Loading branch information
1 parent
291c790
commit 3de0796
Showing
12 changed files
with
174 additions
and
37 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { useState } from 'react'; | ||
import { DatePicker, Space } from 'tdesign-react'; | ||
import type { DatePickerProps, DateValue } from 'tdesign-react'; | ||
|
||
export default function YearDatePicker() { | ||
const [defaultValue, setDefaultValue] = useState<DateValue>(['2000-01-04', '2000-01-03', '2000-01-05']); | ||
|
||
const handleChange: DatePickerProps['onChange'] = (value, context) => { | ||
console.log('onChange:', value, context); | ||
setDefaultValue(value); | ||
}; | ||
|
||
return ( | ||
<div | ||
style={{ | ||
width: '100%', | ||
height: '100vh', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<Space direction="vertical"> | ||
<DatePicker | ||
value={defaultValue} | ||
placeholder="可清除、可输入的日期选择器" | ||
onChange={handleChange} | ||
clearable | ||
multiple | ||
/> | ||
</Space> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.