diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index 196de56..2f67f34 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -16,15 +16,21 @@ }) const position = ref('/') watch(() => $props.info, (newVal) => { - if (newVal.lng && newVal.lat) { - getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { - if (res.data.info === 'OK') { - position.value = res.data.regeocode.formatted_address - } - else { - position.value = '/' - } - }) + console.log(newVal, 'newVal') + if (newVal.position) { + position.value = newVal.position + } + else { + if (newVal.lng && newVal.lat) { + getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { + if (res.data.info === 'OK') { + position.value = res.data.regeocode.formatted_address + } + else { + position.value = '/' + } + }) + } } }, { deep: true, immediate: true }) @@ -32,7 +38,7 @@