ProgressDiy.js 746 Bytes
Newer Older
1 2 3 4 5 6 7 8
/**
 * 解决黔南医保 批量审核时 数据量过大的问题.
 * */
import React, { useEffect, useState } from 'react';
import SpinPercent from './SpinPercent';

export default function ProgressDiy(props) {
	const { componentProps } = props;
钟是志's avatar
钟是志 committed
9
	const { progressDefaultProps } = componentProps;
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
	const [data, setData] = useState(componentProps.data || {});
	const changeData = (newV) => {
	  setData({
      ...newV,
    });
  };

	useEffect(() => {
		if (componentProps) {
			componentProps.changeData = changeData;
		}
	}, []);

	useEffect(() => {
	  if(data){
      componentProps.data = data;
    }
  }, [data]);

	console.log(data);
	return (
		<div>
钟是志's avatar
钟是志 committed
32
			<SpinPercent {...data} progressDefaultProps={progressDefaultProps}/>
33 34 35
		</div>
	);
}