From 39e1dda3ffc0bfa029676fa33c91a936b5379a72 Mon Sep 17 00:00:00 2001 From: jiannibang <271381693@qq.com> Date: Mon, 9 Jan 2023 09:42:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=93=8D=E5=BA=94=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Index/Index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/pages/Index/Index.js b/src/pages/Index/Index.js index bb2d6c2..dc6e85b 100644 --- a/src/pages/Index/Index.js +++ b/src/pages/Index/Index.js @@ -43,6 +43,7 @@ const Index = () => { const [start, _setStart] = useState(null); const [end, _setEnd] = useState(null); const [doFocus, _setDoFocus] = useState(0); + const [focusTextClicked, setFocusTextClicked] = useState(false); useEffect(() => { if (!map) return; @@ -308,6 +309,7 @@ const Index = () => { }, onAzimuthAngleChange: (angle) => setAzimuthAngle(Math.floor((angle / Math.PI) * 180)), + onFocusTextClick: () => setFocusTextClicked(true), }); }; @@ -336,6 +338,19 @@ const Index = () => { } }, [mallInfo]); + useEffect(() => { + if (focusTextClicked) { + if (shop) { + setEnd(shop); + map.startNavigate({ + start, + end: shop, + }); + } + setFocusTextClicked(false); + } + }, [focusTextClicked]); + return (
@@ -367,9 +382,7 @@ const Index = () => { )}