微信小程序模拟器的bug,文档和真机都是 e.detail.controlId,我们后期后拉齐这个差异
callout 问题我们排查下
验证nvue marker 和 moveToLocation 没有问题
<template>
<view>
<map id="map1" class="map1" show-location="true" :latitude="latitude" :longitude="longitude" @regionchange="onregionchange"
@markertap="markertap" scale="16" :markers="markers">
</map>
<button @click="moveToLocation">move to location</button>
</view>
</template>
<script>
export default {
data() {
return {
showCoverView: true,
// latitude: 39.989631,
// longitude: 116.481018,
latitude: 39.925539,
longitude: 116.279037,
image: "/static/logo.png",
markers: [{
id: 110,
iconPath: '/static/logo.png',
latitude: 39.925539,
longitude: 116.279037,
width: "20",
height: "20"
}],
controls: [{
id: 5,
iconPath: '/static/logo.png',
position: {
left: 0,
top: 300 - 50,
width: 50,
height: 50
},
clickable: true
}]
}
},
onReady() {
this.mapContext = uni.createMapContext("map1", this);
},
methods: {
moveToLocation() {
this.mapContext.moveToLocation({
latitude: 39.989631,
longitude: 116.581018,
success: (res) => {
console.log("getCenterLocation");
console.log(res);
}
})
}
}
}
</script>
<style>
.map1 {
width: 750rpx;
height: 400px;
}
</style>
暮雪骄阳 (作者)
抱歉,我自己的疏忽,组件并没有加上show-location="true",用的静态坐标,一直测试结果就是NVUE上moveToLocation没反应,其他端都没问题。加了show-location="true"之后再获取当前位置,moveToLocation就好使了。感谢启发!这个功能实在重要
2020-05-27 17:46
6***@qq.com
麻烦官方看下:moveToLocation移动到指定经纬度在app端ios平台无效,只会移动到当前定位的位置
2020-06-29 20:45
YyJj123123
大哥,这个现在是有问题的。用你这里的代码验证过,大概啥时候能解决?项目挺急的,又没有其他办法了
2022-02-08 13:58