ButtonDiy.js 686 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/**
 * 钟是志
 * 27900 毕业去向管理/单位改签管理---老师新增时,保存反应延迟,会导致重复数据
 * 2022年6月26日
 * */
import React, { useEffect, useState } from 'react';
import { Button } from 'antd';

export default function ButtonDiy(props) {
  const {
    loading,
    onClick,
    ...ev
  } = props;
15 16 17 18 19
  const [loadingThis, setLoading] = useState(false);

  useEffect(() => {
    setLoading(loading);
  }, [loading]);
20 21

  const topOnClick = (e) => {
22
    console.log(e);
23 24 25 26 27 28 29 30 31 32 33
    return onClick(e, setLoading);
  };

  return (
    <Button loading={loadingThis}
            type="primary"
            onClick={topOnClick}
            {...ev}
    />
  );
}