提交 70376ee1 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

perf(h5): open-location 默认显示当前位置 marker

上级 8b8bbfc0
......@@ -9,7 +9,7 @@
>
<div
class="map-move"
@click="moveToLocation"
@click="setCenter(location)"
>
<i>&#xec32;</i>
</div>
......@@ -99,6 +99,15 @@ export default {
}
}
},
mounted () {
uni.getLocation({
type: 'gcj02',
success: ({ latitude, longitude }) => {
this.location.latitude = latitude
this.location.longitude = longitude
}
})
},
methods: {
onRegionChange (event) {
const centerLocation = event.detail.centerLocation
......@@ -111,23 +120,6 @@ export default {
this.center.latitude = latitude
this.center.longitude = longitude
},
moveToLocation () {
uni.getLocation({
type: 'gcj02',
success: this.move.bind(this),
fail: () => {
// move({
// latitude: 0,
// longitude: 0
// })
}
})
},
move ({ latitude, longitude }) {
this.location.latitude = latitude
this.location.longitude = longitude
this.setCenter({ latitude, longitude })
},
back () {
getApp().$router.back()
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册