react 节流按钮组件

该按钮一秒只能点击一次
 
import React from 'react';
import { Button } from 'antd';
import throttle from 'lodash/throttle'

const throttleButton = (props) => {
const { onClick } = props;

  return (
    <Button type="primary" {...props} onClick={throttle(onClick, 1000)}>
      {props.children}
    </Button>
  )
};

export default throttleButton;
posted @ 2021-07-17 19:41  浪浪浪浪浪浪浪浪  阅读(220)  评论(0编辑  收藏  举报