This commit is contained in:
lb 2024-01-25 16:36:12 +08:00
parent 0da9ba434d
commit 97409d61a9
3 changed files with 22 additions and 8 deletions

View File

@ -7,13 +7,23 @@ const EnergyCostRealtime = () => {
const [isPage1, setIsPage1] = useState(false); const [isPage1, setIsPage1] = useState(false);
const energyInfo = useSelector((state) => state.energy?.info); const energyInfo = useSelector((state) => state.energy?.info);
function handleClick() { // function handleClick() {
setIsPage1((pre) => !pre); // setIsPage1((pre) => !pre);
// }
useEffect(() => {
const timer = setInterval(() => {
setIsPage1(pre => !pre);
}, 10000);
return () => {
clearInterval(timer);
} }
}, []);
return ( return (
<> <>
<Arrow key="left" direction="left" onClick={handleClick} /> {/* <Arrow key="left" direction="left" onClick={handleClick} />
<Arrow key="right" direction="right" onClick={handleClick} /> <Arrow key="right" direction="right" onClick={handleClick} /> */}
{isPage1 && ( {isPage1 && (
<div className={`${cls.cost__info} flex`}> <div className={`${cls.cost__info} flex`}>
<div className={`${cls.info__item_groups_col1}`}> <div className={`${cls.info__item_groups_col1}`}>

View File

@ -8,9 +8,13 @@ function Energy(props) {
const energyInfo = useSelector((state) => state.energy?.info); const energyInfo = useSelector((state) => state.energy?.info);
useEffect(() => { useEffect(() => {
setInterval(() => { const timer = setInterval(() => {
setIsPage1((pre) => !pre); setIsPage1((pre) => !pre);
}, 3000); }, 10000);
return () => {
clearInterval(timer);
}
}, []); }, []);
return ( return (

View File

@ -28,5 +28,5 @@
.infoText > span:last-child { .infoText > span:last-child {
color: #00FFF7; color: #00FFF7;
font-size: 28px; font-size: 24px;
} }