You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 566 B

12345678910111213141516171819202122232425
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-28 14:18:11
  4. * @Description: 自定义 Table 单元格,没有数据时展示 --
  5. */
  6. import { Tooltip } from 'antd';
  7. function renderCell(text?: string | null) {
  8. return <span>{text ?? '--'}</span>;
  9. }
  10. function CommonTableCell(ellipsis: boolean = false) {
  11. if (ellipsis) {
  12. return (text?: string | null) => (
  13. <Tooltip title={text} placement="topLeft" overlayStyle={{ maxWidth: '400px' }}>
  14. {renderCell(text)}
  15. </Tooltip>
  16. );
  17. } else {
  18. return renderCell;
  19. }
  20. }
  21. export default CommonTableCell;