From 8573588ea012b5bbf2b23ae17d13e281fab05f05 Mon Sep 17 00:00:00 2001 From: wangyue Date: Sat, 30 Jul 2022 16:45:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=94=E5=88=86=E9=92=9F=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/footer/leadership/left/left-top.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js b/web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js index 12e68bf8..efcae283 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js @@ -11,6 +11,7 @@ const Lefttop = (props) => { const [mass, setMass] = useState() const [speed, setspeed] = useState() const [traffic, setTraffic] = useState() + const [tim, setTim] = useState() const [nums, setNums] = useState() useEffect(() => { const shuju = dispatch(getGodshuju()).then((res) => { @@ -32,9 +33,14 @@ const Lefttop = (props) => { setNums(localStorage.getItem("num")) } }) + }, [tim]) + useEffect(() => { + const timer = setInterval(() => { + setTim(new Date()) + }, 300000); + return () => clearInterval(timer); }, []) - // console.log(mass); - // console.log(nums); + // console.log(tim); return ( <>