图上marker点发生偏移"/>
百度地图上marker点发生偏移
我们是后端返回的具体的位置信息,然后在百度地图上读取的时候不能把具体的坐标读取完全(返回130.2555555555)地图控件读取的时候是(120.2555),解决办法就是直接给marker点新增一个对象
// 向marker中存储数据
this.editMk.item = e
// marker标记点坐标
this.poleList.forEach(e => {
this.editPoint = new BMap.Point(e.lng, e.lat)
// 添加marker图片 设置大小 标记点不能拖动 没有定义缩放地图时改变图片大小this.editMk = new BMap.Marker(this.editPoint, { icon: new BMap.Icon(require('@/assets/bigScreen/dian.png'), new BMap.Size(18, 18), { imageSize: new BMap.Size(18, 18) }), enableMassClear: false, enableDragging: false })// 向marker中存储数据this.editMk.item = ethis.map.addOverlay(this.editMk)this.editMk.addEventListener('click', (e) => {// that.showHidePole = trueconsole.log(e, 'woshi eeee')this.$refs.poles.style.display = 'block'const lng = e.target.item.lngconst lat = e.target.item.latconst projectId = window.localStorage.getItem('equipmentProject')const params = {lng: lng,lat: lat,projectId: projectId}queryPoleAndAttributeDeviceByLatAndLng(params).then(res => {console.log(res.data, '新增灯杆信息')this.deviceName = res.data[0].pole.deviceName// 灯杆名称this.deviceCode = res.data[0].pole.deviceCode// 灯杆编号})})})
更多推荐
百度地图上marker点发生偏移
发布评论