mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
type: breadcroumb use AnyObject (#43717)
* fix: breadcroumb use AnyObject * fix: 显示声明import type * style: 修改代码格式
This commit is contained in:
parent
66c686ed16
commit
5104bf9981
@ -13,6 +13,7 @@ import type { DropdownProps } from '../dropdown';
|
||||
import useStyle from './style';
|
||||
import useItemRender from './useItemRender';
|
||||
import useItems from './useItems';
|
||||
import type { AnyObject } from '../_util/type';
|
||||
|
||||
export interface BreadcrumbItemType {
|
||||
key?: React.Key;
|
||||
@ -46,7 +47,7 @@ export type ItemType = Partial<BreadcrumbItemType & BreadcrumbSeparatorType>;
|
||||
|
||||
export type InternalRouteType = Partial<BreadcrumbItemType & BreadcrumbSeparatorType>;
|
||||
|
||||
export interface BreadcrumbProps<T extends Record<PropertyKey, any> = any> {
|
||||
export interface BreadcrumbProps<T extends AnyObject = AnyObject> {
|
||||
prefixCls?: string;
|
||||
params?: T;
|
||||
separator?: React.ReactNode;
|
||||
@ -63,7 +64,7 @@ export interface BreadcrumbProps<T extends Record<PropertyKey, any> = any> {
|
||||
itemRender?: (route: ItemType, params: T, routes: ItemType[], paths: string[]) => React.ReactNode;
|
||||
}
|
||||
|
||||
const getPath = <T extends Record<PropertyKey, any> = any>(params: T, path?: string) => {
|
||||
const getPath = <T extends AnyObject = AnyObject>(params: T, path?: string) => {
|
||||
if (path === undefined) {
|
||||
return path;
|
||||
}
|
||||
@ -74,7 +75,7 @@ const getPath = <T extends Record<PropertyKey, any> = any>(params: T, path?: str
|
||||
return mergedPath;
|
||||
};
|
||||
|
||||
const Breadcrumb = <T extends Record<PropertyKey, any> = any>(props: BreadcrumbProps<T>) => {
|
||||
const Breadcrumb = <T extends AnyObject = AnyObject>(props: BreadcrumbProps<T>) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
separator = '/',
|
||||
@ -151,10 +152,7 @@ const Breadcrumb = <T extends Record<PropertyKey, any> = any>(props: BreadcrumbP
|
||||
<InternalBreadcrumbItem
|
||||
key={mergedKey}
|
||||
{...itemProps}
|
||||
{...pickAttrs(item, {
|
||||
data: true,
|
||||
aria: true,
|
||||
})}
|
||||
{...pickAttrs(item, { data: true, aria: true })}
|
||||
className={itemClassName}
|
||||
dropdownProps={dropdownProps}
|
||||
href={href}
|
||||
|
Loading…
Reference in New Issue
Block a user