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

feat: map 补充示例

# Conflicts:
#	pages/component/map/map.uvue
上级 2bc5e8aa
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<button class="button" @click="handleGetRegion">获取当前地图的视野范围</button> <button class="button" @click="handleGetRegion">获取当前地图的视野范围</button>
<button class="button" @click="handleTranslateMarker">平移marker</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> <button class="button" @click="handleGetScale">获取当前地图的缩放级别</button>
</scroll-view> </scroll-view>
...@@ -618,6 +619,19 @@ ...@@ -618,6 +619,19 @@
}); });
}; };
const handleMoveToMyLocation = () => {
mapContext.value?.moveToLocation({
success: res => {
uni.showModal({
content: '地图中心已经移动到当前位置'
})
},
fail: error => {
console.log(error);
}
})
}
const maptap = (e : UniMapTapEvent) => { const maptap = (e : UniMapTapEvent) => {
// console.log('点击地图时触发',e) // console.log('点击地图时触发',e)
uni.showModal({ uni.showModal({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册