In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
今天小编给大家分享一下vue如何使用高德地图根据坐标定位点的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。
代码
var map,marker;export default { data(){ return{ arriveCoor:[108.947025,34.2613255],//坐标点 arrive:"",//位置信息 } }, mounted() { mapDraw(this.arriveCoor), mapCoor(this.arriveCoor) }, methods:{ mapDraw(arriveCoor){ map = new AMap.Map('map-location', { //map-location是嵌地图div的id resizeEnable: true, //是否监控地图容器尺寸变化 zoom:16, //初始化地图层级 center: arriveCoor //初始化地图中心点 }); // 定位点 this.addMarker(arriveCoor); }, // 实例化点标记 addMarker(arriveCoor) { var _this = this; marker = new AMap.Marker({ icon: "", //图片ip imageSize: "20px", position: arriveCoor, offset: new AMap.Pixel(-13, -30), // 设置是否可以拖拽 draggable: true, cursor: 'move', // 设置拖拽效果 raiseOnDrag: true }); marker.setMap(map); }, // 查询坐标 mapCoor(lnglatXY){ var _this = this; AMap.service('AMap.Geocoder',function() {//回调函数 var geocoder = new AMap.Geocoder({}); geocoder.getAddress(lnglatXY, function (status, result) { if (status === 'complete' && result.info === 'OK') { //获得了有效的地址信息: _this.arrive = result.regeocode.formattedAddress; else { _this.arrive = "暂无位置"; } }); }) },}以上就是"vue如何使用高德地图根据坐标定位点"这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注行业资讯频道。
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.