Это мой скрипт:
html:
Код: Выделить всё
Код: Выделить всё
#map-container{
height: 650px;
width: 650px;
}
#map {
max-height: 600px;
max-width: 600px;
}
< /code>
js: < /p>
async function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center,
zoom: 13,
mapId: '4504f8b37365c3d0',
mapTypeControl: false,
});
const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement();
//@ts-ignore
placeAutocomplete.id = 'place-autocomplete-input';
placeAutocomplete.locationBias = center;
const card = document.getElementById('place-autocomplete-card');
//@ts-ignore
card.appendChild(placeAutocomplete);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(card);
// Create the marker and infowindow.
marker = new google.maps.marker.AdvancedMarkerElement({
map,
});
infoWindow = new google.maps.InfoWindow({});
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... tocomplete