We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用于类似开关控制切换的效果,也类似 Tab 切换。
虽然 tab/switch 组件也可以做到,但是 segmented 样式以及 block 的效果会比较好看。
https://github.com/react-component/segmented/blob/master/src/index.tsx#L9
- export type SegmentedValue = string | number; + export type SegmentedValue = string | number | boolean;
const Demo: React.FC = () => ( <Segmented options={[ { label: '教学空间', value: true }, { label: '学习空间', value: false }, ]} /> );
The text was updated successfully, but these errors were encountered:
和 Select 一样支持泛型吧,默认就是 string | number 就好
string | number
Sorry, something went wrong.
顺带在此一提,Tabs组件是否也能够支持泛型呢?目前仅支持 string 类型,有一些场景是,使用 enum 作为 Tab 页的 key,而 enum 的值可能是 number 类型也可能是 string 类型,但此时 enum 本身将会作为一个类型使用。
Tabs
See #47091
No branches or pull requests
What problem does this feature solve?
用于类似开关控制切换的效果,也类似 Tab 切换。
虽然 tab/switch 组件也可以做到,但是 segmented 样式以及 block 的效果会比较好看。
What does the proposed API look like?
https://github.com/react-component/segmented/blob/master/src/index.tsx#L9
The text was updated successfully, but these errors were encountered: