Closed readgo closed 3 weeks ago
沙盒地址:https://codesandbox.io/p/sandbox/lucid-kepler-lt8w6r?file=%2Findex.js%3A11%2C6 错误日志 TypeError Cannot destructure property 'lng' of 'e.lnglat' as it is undefined. at Map.eval (https://lt8w6r.csb.app/node_modules/ antv/l7-component/es/marker.js:43:19 Map.emit https://lt8w6r.csb.app/node_modules/eventemitter3/index.js:181:35 at BlockableMapEventHandler.mousemove (https://lt8w6r.csb.app/node_modules/ antv/l7-map/es/handler/blockable_map_event.js:20:14 at HTMLDivElement.eval (https://lt8w6r.csb.app/node_modules/ antv/l7-map/es/handler/handler_manager.js:92:39 This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error. This error overlay is powered by react-error-overlay used in create-react-app.
react-error-overlay
create-react-app
代码 import { Scene, PointLayer, Marker } from "@antv/l7"; import { Map } from "@antv/l7-maps";
const scene = new Scene({ id: "map", map: new Map({ style: "light", center: [121, 31], zoom: 14.89, minZoom: 10, }), }); scene.on("loaded", () => { const m_resize = new Marker({ draggable: true, offsets: [-4, -4], }).setLnglat({ lng: 121, lat: 31, }); scene.addMarker(m_resize); });
hi @readgo, welcome!
Hi @readgo, Please star this repo if you find it useful! Thanks :star:! 你好~ @readgo 🌟 如果这个仓库对你有帮助,可以给我们点个star支持一下~你的支持对我们来说是最大的鼓励,感谢你的支持与点赞 🌟
重复问题 #2487
@antv/l7@2.22.0 已修复
沙盒地址:https://codesandbox.io/p/sandbox/lucid-kepler-lt8w6r?file=%2Findex.js%3A11%2C6 错误日志 TypeError Cannot destructure property 'lng' of 'e.lnglat' as it is undefined. at Map.eval (https://lt8w6r.csb.app/node_modules/ antv/l7-component/es/marker.js:43:19 Map.emit https://lt8w6r.csb.app/node_modules/eventemitter3/index.js:181:35 at BlockableMapEventHandler.mousemove (https://lt8w6r.csb.app/node_modules/ antv/l7-map/es/handler/blockable_map_event.js:20:14 at HTMLDivElement.eval (https://lt8w6r.csb.app/node_modules/ antv/l7-map/es/handler/handler_manager.js:92:39 This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error. This error overlay is powered by
react-error-overlay
used increate-react-app
.代码 import { Scene, PointLayer, Marker } from "@antv/l7"; import { Map } from "@antv/l7-maps";
const scene = new Scene({ id: "map", map: new Map({ style: "light", center: [121, 31], zoom: 14.89, minZoom: 10, }), }); scene.on("loaded", () => { const m_resize = new Marker({ draggable: true, offsets: [-4, -4], }).setLnglat({ lng: 121, lat: 31, }); scene.addMarker(m_resize); });