更新记录

1.0.2(2025-08-26) 下载此版本

说明修改

1.0.1(2025-08-26) 下载此版本

多场景使用,附近的数据(商家/人...)多标记点显示。 ①多标记点图文。可选中标记点获取当前标记点信息; ②移动地图,显示中心点附近的数据 ③地图放大缩小 ④回到当前的位置 ......


平台兼容性

uni-app(4.08)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - -

uni-app x(4.08)

Chrome Safari Android iOS 鸿蒙 微信小程序
- - - - - -

##### ### 小程序腾讯地图多标记点组件

描述:

多场景使用,附近的数据(商家/人…)多标记点显示。
①多标记点图文。可选中标记点获取当前标记点信息;
②移动地图,显示中心点附近的数据
③地图放大缩小
④回到当前的位置
……

可自行修改为自己合适的….

使用
  1. <template>
  2. <!--腾讯地图插件-->
  3. <mapView v-if="isShow" :markersArr="markerArr" :myLcat="myLocation" @chooseMarker="getChooseMarker" @moveMapView="getMapCenterLoca"></mapView>
  4. </template>
  5. <script setup>
  6. import { nextTick, onMounted, ref } from 'vue';
  7. import mapView from '@/components/my-map/my-map.vue'
  8. const markerArr = ref([]);//标记点,可动态获取
  9. const isShow = ref(false);//
  10. const myLocation = ref({});//用户发送到后台请求对应的数据
  11. onMounted(()=>{
  12. getMapMarkersList();
  13. nextTick(()=>{
  14. isShow.value = true;
  15. })
  16. getMyLocation();
  17. });
  18. //获取地图移动的中心坐标
  19. const getMapCenterLoca = (e)=>{
  20. console.log("中心坐标:",e);
  21. };
  22. //获取选中的标记
  23. const getChooseMarker = (e) =>{
  24. console.log("选中的气泡标记:",e);
  25. };
  26. //获取当前所在的位置
  27. const getMyLocation =()=>{
  28. //获得当前的位置
  29. uni.getLocation({
  30. type: 'gcj02', //返回国测局坐标
  31. success(e) {
  32. // console.log(e,"我的位置")
  33. myLocation.value = e;
  34. },
  35. fail(e) {
  36. console.log('失败', e);
  37. }
  38. })
  39. }
  40. //获取位置中心范围内的数据
  41. const getMapMarkersList = () =>{
  42. markerArr.value = [
  43. {
  44. id:1,
  45. longitude:'115.851002', //经度
  46. latitude:'28.689684',//纬度
  47. iconPath:'/static/ad/ad01.jpg',//缩略图
  48. width:40,
  49. height: 40,
  50. title:'商家1',
  51. address:'商家标记地址1',
  52. alpha: 1, //透明度
  53. callout: { //自定义标记点上方的气泡窗口 点击有效
  54. content: '商家标记点1',//文本
  55. color: '#ffffff',//文字颜色
  56. fontSize: 12,//文本大小
  57. borderRadius: 5,//边框圆角
  58. padding:7,
  59. bgColor: '#3f94fd',//背景颜色
  60. display: 'ALWAYS',//常显
  61. },
  62. },
  63. {
  64. id:2,
  65. longitude:'115.880356',
  66. latitude:'28.643896',
  67. iconPath:'/static/ad/ad02.jpg',
  68. width:40,
  69. height: 40,
  70. title:'商家2',
  71. address:'商家标记地址2',
  72. alpha: 1,
  73. callout: { //气泡窗口
  74. content:'商家标记点2',
  75. color: '#ffffff',
  76. fontSize: 12,
  77. borderRadius: 5,
  78. padding:7,
  79. bgColor: '#3f94fd',
  80. display: 'ALWAYS',
  81. },
  82. },
  83. {
  84. id:3,
  85. longitude:'115.902672',
  86. latitude:'28.671311',
  87. iconPath:'/static/ad/ad03.jpg',
  88. width:40,
  89. height: 40,
  90. title:'商家3',
  91. address:'商家标记地址3',
  92. alpha: 1,
  93. callout: { //气泡窗口
  94. content: '商家标记点3',
  95. color: '#ffffff',
  96. fontSize: 12,
  97. borderRadius: 5,
  98. padding:7,
  99. bgColor: '#3f94fd',
  100. display: 'ALWAYS',
  101. },
  102. },
  103. {
  104. id:4,
  105. longitude:'115.881386',
  106. latitude:'28.682456',
  107. iconPath:'/static/ad/ad02.jpg',
  108. width:40,
  109. height: 40,
  110. title:'商家4',
  111. address:'商家标记地址4',
  112. alpha: 1,
  113. callout: { //气泡窗口
  114. content: '商家标记点4',
  115. color: '#ffffff',
  116. fontSize: 12,
  117. borderRadius: 5,
  118. padding:7,
  119. bgColor: '#3f94fd',
  120. display: 'ALWAYS',
  121. },
  122. },
  123. {
  124. id:5,
  125. longitude:'115.854435',
  126. latitude:'28.677787',
  127. iconPath:'/static/ad/ad01.jpg',
  128. width:40,
  129. height: 40,
  130. title:'商家5',
  131. address:'商家标记地址5',
  132. alpha: 1,
  133. callout: { //气泡窗口
  134. content: '商家标记点5',
  135. color: '#ffffff',
  136. fontSize: 12,
  137. borderRadius: 5,
  138. padding:7,
  139. bgColor: '#3f94fd',
  140. display: 'ALWAYS',
  141. },
  142. },
  143. {
  144. id:6,
  145. longitude:'115.848255',
  146. latitude:'28.660617',
  147. iconPath:'/static/ad/ad02.jpg',
  148. width:40,
  149. height: 40,
  150. title:'商家6',
  151. address:'商家标记地址6',
  152. alpha: 1,
  153. callout: { //气泡窗口
  154. content: '商家标记点6',
  155. color: '#ffffff',
  156. fontSize: 12,
  157. borderRadius: 5,
  158. padding:7,
  159. bgColor: '#3f94fd',
  160. display: 'ALWAYS',
  161. },
  162. },
  163. {
  164. id:7,
  165. longitude:'115.849972',
  166. latitude:'28.670407',
  167. iconPath:'/static/ad/ad03.jpg',
  168. width:40,
  169. height: 40,
  170. title:'商家7',
  171. address:'商家标记地址7',
  172. alpha: 1,
  173. callout: { //气泡窗口
  174. content: '商家标记点7',
  175. color: '#ffffff',
  176. fontSize: 12,
  177. borderRadius: 5,
  178. padding:7,
  179. bgColor: '#3f94fd',
  180. display: 'ALWAYS',
  181. },
  182. },
  183. {
  184. id:8,
  185. longitude:'115.900612',
  186. latitude:'28.661671',
  187. iconPath:'/static/ad/ad01.jpg',
  188. width:40,
  189. height: 40,
  190. title:'商家8',
  191. address:'商家标记地址8',
  192. alpha: 1,
  193. callout: { //气泡窗口
  194. content: '商家标记点8',
  195. color: '#ffffff',
  196. fontSize: 12,
  197. borderRadius: 5,
  198. padding:7,
  199. bgColor: '#3f94fd',
  200. display: 'ALWAYS',
  201. },
  202. },
  203. ];
  204. }
  205. </script>
  206. <style>
  207. </style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

需要申请用户的位置(不是必须的,根据用户的需求是否使用) 在 manifest.json 中添加 "mp-weixin" : { //添加 "permission" : { "scope.userLocation" : { "desc" : "获取位置信息" } }, "requiredPrivateInfos" : [ "getLocation" ] },

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。