Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都可以编写一些代码来从用户那里获取输入(坐标)以在地图上显示为标记,并继续添加带有新纬度、经度的标记以及删除标记的选项。请。
我已经写了这段代码: 在此处输入图像描述
这段代码应该可以工作,如果没有,请告诉我。
const [position,setPosition] = useState([]); const getLocation = () => { navigator.geolocation.getCurrentPosition(function(pos) { setPosition([pos.coords.latitude,pos.coords.longitude]); },);