百度地图上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 = e
            this.map.addOverlay(this.editMk)
            this.editMk.addEventListener('click', (e) => {
                // that.showHidePole = true
                console.log(e, 'woshi eeee')
                this.$refs.poles.style.display = 'block'
                const lng = e.target.item.lng
                const lat = e.target.item.lat
                const 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// 灯杆编号
                })
            })
        })
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值