微信小程序 - 多地点标识(map)
发布时间:2020-12-14 19:36:38 所属栏目:资源 来源:网络整理
导读:演示如下: wxml 1 map id = "map" scale "{{scale}}" controls "{{controls}}" bindcontroltap "controltap" markers "{{markers}}" bindmarkertap "markertap" bindregionchange "regionchange" show - location style "width: 100%; height: 580px;" / ma
演示如下: wxml
js let hospitalData =require('hospitalData') 3 data:{ 5 centerY 11 iconPath '/image/location-control.png' 20 21 onReadyfunction(e){ 23 this.mapCtx wxcreateMapContext'myMap') 26 onLoad(){ ) 29 wxgetLocation({ //返回可以用于wx.openLocation的经纬度 33 longitude longitude; 35setData({ 37 centerY latitude38 markersgetHospitalMarkers() 40} 42 45 * 标示点移动触发 47 regionchange{ 49 53 */ 55) 58/** 60 */ 63moveToLocation() 67/** 69 */ 71 markers []; 74 markerspushmarker) 76return; 79/** 81 */ 85868788 89 * 还有地图标识,可以在name上面动手 91 createMarkerpoint92 point939495"/image/location.png"96id ||97 namename ''98 latitude99 longitude100 width25101 height48 103 marker104} hospitalData.js (模拟数据)
} 运行示例时,建议放在同一目录下. |