高德地图自定义背景功能

示例

在这里插入图片描述

需要用的就是上述图片展示的 高德地图js2.0的区域掩膜功能
然后再进行控制台找到图片中 地图的主体结构 进行样式修改就可以了 样式可以自行替换为背景图

在这里插入图片描述

地图背景的网格去除的话需要再 高德官网自定义地图中 编辑自定义地图进行去除

在这里插入图片描述
在这里插入图片描述

编辑自己的自定义地图就可以看到这个了 去除即可

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
Vue高德地图自定义标记可以通过以下步骤实现: 1. 在Vue组件中引入高德地图API: ``` import AMapLoader from '@amap/amap-jsapi-loader'; ``` 2. 在Vue组件中定义地图容器,并在mounted钩子函数中加载地图: ``` <template> <div id="map-container"></div> </template> <script> export default { data() { return { map: null, }; }, mounted() { AMapLoader.load({ key: 'your-api-key', version: '2.0', plugins: ['AMap.Marker'], }).then(() => { this.initMap(); }); }, methods: { initMap() { this.map = new AMap.Map('map-container', { center: [116.397428, 39.90923], zoom: 13, }); }, }, }; </script> ``` 3. 在Vue组件中定义自定义标记的样式,并使用AMap.Marker类创建自定义标记对象: ``` <template> <div id="map-container"></div> </template> <script> export default { data() { return { map: null, markerStyle: { width: '24px', height: '24px', background: 'url("your-marker-icon.png") no-repeat', backgroundSize: '100% 100%', }, }; }, mounted() { AMapLoader.load({ key: 'your-api-key', version: '2.0', plugins: ['AMap.Marker'], }).then(() => { this.initMap(); this.addMarker(); }); }, methods: { initMap() { this.map = new AMap.Map('map-container', { center: [116.397428, 39.90923], zoom: 13, }); }, addMarker() { const marker = new AMap.Marker({ position: [116.397428, 39.90923], map: this.map, icon: new AMap.Icon(this.markerStyle), }); }, }, }; </script> ``` 4. 根据需要,可以在自定义标记上添加事件监听器: ``` <template> <div id="map-container"></div> </template> <script> export default { data() { return { map: null, markerStyle: { width: '24px', height: '24px', background: 'url("your-marker-icon.png") no-repeat', backgroundSize: '100% 100%', }, }; }, mounted() { AMapLoader.load({ key: 'your-api-key', version: '2.0', plugins: ['AMap.Marker'], }).then(() => { this.initMap(); this.addMarker(); }); }, methods: { initMap() { this.map = new AMap.Map('map-container', { center: [116.397428, 39.90923], zoom: 13, }); }, addMarker() { const marker = new AMap.Marker({ position: [116.397428, 39.90923], map: this.map, icon: new AMap.Icon(this.markerStyle), }); marker.on('click', () => { alert('Marker clicked!'); }); }, }, }; </script> ``` 以上就是Vue高德地图自定义标记的实现方法。需要注意的是,自定义标记的样式需要根据实际情况进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值