|
|
|
@ -28,7 +28,7 @@ const instance = defineStore('user', { |
|
|
|
|
actions: { |
|
|
|
|
getPosition() { |
|
|
|
|
this.position = { latitude: 36.636753, longitude: 119.11914 } |
|
|
|
|
return |
|
|
|
|
// return
|
|
|
|
|
initAMap().then(() => { |
|
|
|
|
// console.log(3)
|
|
|
|
|
let AMap = Vue.prototype.$AMap |
|
|
|
@ -36,12 +36,14 @@ const instance = defineStore('user', { |
|
|
|
|
// enableHighAccuracy: true // 是否使用高精度定位,默认:true
|
|
|
|
|
}) |
|
|
|
|
geolocation.getCurrentPosition(function (status, result) { |
|
|
|
|
console.log(2) |
|
|
|
|
if (status === 'complete') { |
|
|
|
|
let { lat: latitude, lng: longitude } = result.position |
|
|
|
|
this.position = { latitude, longitude } |
|
|
|
|
console.log('this.position', this.position) |
|
|
|
|
} |
|
|
|
|
console.log('geolocation.getCurrentPosition') |
|
|
|
|
console.log('status', status) |
|
|
|
|
console.log('result', result) |
|
|
|
|
// if (status === 'complete') {
|
|
|
|
|
// let { lat: latitude, lng: longitude } = result.position
|
|
|
|
|
// this.position = { latitude, longitude }
|
|
|
|
|
// console.log('this.position', this.position)
|
|
|
|
|
// }
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return |
|
|
|
|