|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
+ <button type="primary" @click="location">位置定位</button>
|
|
|
<map id="map" class="map" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -71,7 +72,21 @@
|
|
|
console.log('addMarkers', res)
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ //位置定位
|
|
|
+ location(){
|
|
|
+ uni.openLocation({
|
|
|
+ latitude: 45.780558,
|
|
|
+ longitude: 125.384426,
|
|
|
+ success: function (res) {
|
|
|
+ console.log('打开系统位置地图成功')
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|