mapcontext.getmapproperties(object object)
基础库 或更高版本; 且 支付宝客户端 10.1.82 或更高版本; 若版本较低,建议采取 兼容处理 。
小程序开发者工具: 支持。
主体: 企业支付宝小程序 、 个人支付宝小程序
获取地图的属性信息。
object object
查看示例
属性 | 类型 | 默认值 | 必填 | 描述 |
---|---|---|---|---|
success | function | - | 否 | 调用成功的回调函数 |
fail | function | - | 否 | 调用失败的回调函数 |
complete | function | - | 否 | 调用结束的回调函数(调用成功、失败都会执行) |
success 回调函数
参数
object res
查看示例
属性 | 类型 | 兼容性 | 描述 |
---|---|---|---|
height | number | - | 地图高度 |
width | number | - | 地图宽度 |
is3d | boolean | - | 是否是 3d 地图引擎。更多信息可查看 |
issupportanim | boolean | - | 是否支持动画 |
sdkname | string | 支付宝: 10.1.90 |
地图中使用的 sdk 名称。 |
sdkversion | string | 支付宝: 10.1.90 |
地图中使用的 sdk 版本号。 |
issupportoversea | boolean | 支付宝: 10.1.90 |
是否支持海外地图 |
needstylev7 | boolean | 支付宝: 10.1.90 |
是否需要 7.x 版本自定义地图样式配置文件。 |
mapcontext.getmapproperties axml 代码
mapcontext.getmapproperties js 代码
success 参数
<view>
<map id="map" style="width:100%; height:500px"/>
<button ontap="getmapproperties">获取地图的属性信息</button>
</view>
page({
data: {
mapctx: null
},
onready() {
this.data.mapctx = my.createmapcontext('map');
},
// 获取当前地图的旋转角
getmapproperties() {
this.data.mapctx.getmapproperties({
success: res => {
console.log(res);
},
fail: error => {
console.log(error)
}
});
}
});
{
"height":500,
"is3d":true,
"issupportanim":true,
"issupportoversea":true,
"needstylev7":true,
"sdkname":"amap",
"sdkversion":"7.1.14",
"success":true,
"width":373
}