Uncaught InvalidValueError: setMap: not an instance of Map

前端 未结 7 1173
萌比男神i
萌比男神i 2021-02-19 12:23

when i used the sencha touch2.2.1,i met a question. In the viewer:

items: [{
    id: \'mapCanvas\',
    xtype:\'map\',
    useCurrentLocation: true,
}]
         


        
7条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 12:57

    var map is a HTML element you need an instance of the google.maps.Map Object

    var map = google.maps.Map(document.querySelector("#mapCanvas"),{
          center: new google.maps.LatLng(24.027872, -104.655278),
          zoom: 12
        });
    

    then....

    var marker= new google.maps.Marker({
      position: new google.maps.LatLng(25,118),
      map: map
        });
    

提交回复
热议问题