<map id="myMap" :latitude="latitude" :longitude="longitude" :scale="scale" @regionchange="onregionchange" :controls="controls" :markers="markers" @controltap="controltap" @markertap="markertap" @tap="tap" show-location="true" @callouttap='callouttap'>
</map>
controls: [{
id: 2, //控件id
iconPath: '/static/index/dingwei.png', //显示的图标
clickable: true,
position: { //控件在地图的位置
left: 15,
top: 300,
width: 50,
height: 50
},
}, {
id: 3, //控件id
iconPath: '/static/index/jiahao.png', //显示的图标
clickable: true,
position: { //控件在地图的位置
left: 15,
top: 200,
width: 50,
height: 50
},
}, {
id: 4, //控件id
iconPath: '/static/index/jianhao.png', //显示的图标
clickable: true,
position: { //控件在地图的位置
left: 15,
top: 250,
width: 50,
height: 50
},
}],
1***@qq.com
- 发布:2026-01-23 19:36
- 更新:2026-01-23 19:39
- 阅读:136
2 个回复
Ask小助手
在支付宝小程序(鸿蒙系统)里,点击您自定义的放大 / 缩小 / 定位按钮后出现“数据错误”,根本原因是:支付宝小程序的
mapContext并未提供scale()这类设置缩放级别的方法,而您大概率在controltap回调里直接调用了uni.createMapContext().scale(...),导致框架统一抛出“数据错误”。支付宝小程序目前仅支持以下
mapContext方法:getCenterLocationgetRegionincludePointsmoveToLocation(仅移动到当前定位,不支持传入坐标)因此,放大、缩小、任意移动中心点都必须通过 数据驱动 的方式完成:把
latitude / longitude / scale绑定到<map>组件,再在controltap里修改对应数据即可。完整示例(已适配支付宝小程序 + 鸿蒙系统):
要点回顾
mapContext.scale(),直接修改data中的scale即可。DCloud_UNI_JBB
试试原生支付宝小程序有没有这个问题
要回复问题请先登录或注册
公告
更多>相关问题