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