1***@qq.com
1***@qq.com
  • 发布:2024-03-15 10:07
  • 更新:2024-03-18 16:30
  • 阅读:63

map组件加载maker 手机模式运行时位置不对 会随地图缩放移动

分类:uni小程序sdk

正常位置


小程序 运行时 位置偏差很大 缩放地图 maker位置随之变化

网页端 手机模式 也会发生偏移

源码 <template> <view class = "content"> <map style="width: 100%; height: 90vh;" :style="{height:mapheight}" :show-location='true'

scale="scale" :latitude="latitude" :longitude="longitude" :markers="marker" :enable-zoom='true' @markertap="markertap" @callouttap='callouttap'>

</map>  

</view>
</template>.

adddata() {  
            console.log("===adddata===");  
        this.list.map((item, index) => {  
            this.marker.push({  
                id: index + 1,  
                latitude: item.lat, //纬度  
                longitude: item.lng, //经度  
                iconPath: '/static/map/qa.png', //显示的图标          
                rotate: 0, // 旋转度数  
                width: 10, //宽  

                height: 10, //高  
                title: item.name, //标注点名  
                alpha: 0, //透明度  
                                          },  
                callout: { //自定义标记点上方的气泡窗口 点击有效    
                    content: item.name, //文本  
                    color: '#ffffff', //文字颜色  
                    fontSize: 14, //文本大小  
                    borderRadius: 15, //边框圆角  
                    borderWidth: '0',  
                    bgColor: item.flag == "0" ? '#e51860' : '#43b80d', //背景颜色  
                    display: 'ALWAYS', //常显  
                },  

            })  
        })  

    }  
2024-03-15 10:07 负责人:无 分享
已邀请:
JXWang

JXWang

我试了一下没发现有标记点会随着地图缩放偏移的情况,是否有其他逻辑会更改this.marker的值,this.adddata方法只会被调用一次吗?能否提供一份完整的代码便于排查

要回复问题请先登录注册