📅  最后修改于: 2022-03-11 15:03:09.877000             🧑  作者: Mango
function getCoordinates(address){
fetch("https://maps.googleapis.com/maps/api/geocode/json?address="+address+'&key='+API_KEY)
.then(response => response.json())
.then(data => {
const latitude = data.results.geometry.location.lat;
const longitude = data.results.geometry.location.lng;
console.log({latitude, longitude})
})
}