提交 e25a51f1 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

feat: map 补充示例

上级 5fdb744e
......@@ -43,7 +43,8 @@
<button class="button" @click="handleGetCenterLocation">获取当前地图中心的经纬度</button>
<button class="button" @click="handleGetRegion">获取当前地图的视野范围</button>
<button class="button" @click="handleTranslateMarker">平移marker</button>
<button class="button" @click="handleMoveToLocation">将地图中心移动到指定坐标</button>
<button class="button" @click="handleMoveToLocation">将地图中心移动到指定坐标</button>
<button class="button" @click="handleMoveToMyLocation">将地图中心移动到当前位置</button>
<button class="button" @click="handleGetScale">获取当前地图的缩放级别</button>
</scroll-view>
......@@ -616,7 +617,20 @@
console.log(error)
}
});
};
};
const handleMoveToMyLocation = () => {
mapContext.value?.moveToLocation({
success: res => {
uni.showModal({
content: '地图中心已经移动到当前位置'
})
},
fail: error => {
console.log(error);
}
})
}
const maptap = (e : UniMapTapEvent) => {
// console.log('点击地图时触发',e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册