diff --git a/packages/table/src/components/ToolBar/DensityIcon.tsx b/packages/table/src/components/ToolBar/DensityIcon.tsx index cc166f6a6a69..54436b82a96a 100644 --- a/packages/table/src/components/ToolBar/DensityIcon.tsx +++ b/packages/table/src/components/ToolBar/DensityIcon.tsx @@ -7,10 +7,11 @@ import { TableContext } from '../../Store/Provide'; export type DensitySize = 'middle' | 'small' | 'large' | undefined; -const DensityIcon = () => { +const DensityIcon = (props: { icon?: React.ReactNode }) => { + const { icon = } = props; const counter = useContext(TableContext); const intl = useIntl(); - const props = menuOverlayCompatible({ + const dropdownProps = menuOverlayCompatible({ selectedKeys: [counter.tableSize as string], onClick: ({ key }) => { counter.setTableSize?.(key as DensitySize); @@ -33,10 +34,13 @@ const DensityIcon = () => { }, ], }); + + console.log('props', props); + return ( - + - + {icon} ); diff --git a/packages/table/src/components/ToolBar/index.tsx b/packages/table/src/components/ToolBar/index.tsx index c07d1947bdb9..783a4757ff02 100644 --- a/packages/table/src/components/ToolBar/index.tsx +++ b/packages/table/src/components/ToolBar/index.tsx @@ -83,7 +83,7 @@ function getButtonText( }, density: { text: intl.getMessage('tableToolBar.density', '表格密度'), - icon: options.densityIcon ?? , + icon: , }, fullScreen: { text: intl.getMessage('tableToolBar.fullScreen', '全屏'),