import type { ButtonProps } from 'antd'; import { Button as AntdButton } from 'antd'; import _ from 'lodash'; import React, { useMemo } from 'react'; import styles from './index.module.css'; type PropType = { onClick?: (e: React.MouseEvent) => void; width?: number | string; ref?: any; } & ButtonProps; const Button: React.FC = (param) => { const { children, width, onClick } = param; const others = _.omit(param, ['children', 'onClick', 'width', 'style', 'className']); const onClickThrottle = useMemo( () => _.debounce( (e) => { if (onClick) onClick(e); }, 600, { leading: true, trailing: false } ), [onClick] ); return ( onClickThrottle(e)} {...others} > {children} ); }; export default Button;