简体   繁体   English

谷歌地图加载错误“谷歌”未定义

[英]google maps load error “google” undefined

ok, I have a problem on this when loading the maps, this part will shows "google" as undefined . 好吧,我在加载地图时遇到问题,这部分会将“google”显示为undefined

var polyline = [
    new Google.map.LatLng(3.032617, 101.376),
    new Google.map.LatLng(3.03255, 101.3759),
    new Google.map.LatLng(3.032467, 101.3758),
    new Google.map.LatLng(3.031867, 101.3753),
    new Google.map.LatLng(3.0318, 101.3753)
];

var polylineopts = {
  path: polyline,
  map: map,
  strokecolor: 'blue',
  strokeopacity: 1.6,
  strokeweight: 3,
  geodesic: true
};

var poly = new google.maps.Polyline(polylineopts);

I expect the error is "Google" is undefined. 我预计错误是“Google”未定义。 Javascript is case sensitive. Javascript区分大小写。

Should be: 应该:

var polyline = [
    new google.maps.LatLng(3.032617, 101.376),
    new google.maps.LatLng(3.03255, 101.3759),
    new google.maps.LatLng(3.032467, 101.3758),
    new google.maps.LatLng(3.031867, 101.3753),
    new google.maps.LatLng(3.0318, 101.3753)
];

var polylineopts = {
  path: polyline,
  map: map,
  strokecolor: 'blue',
  strokeopacity: 1.6,
  strokeweight: 3,
  geodesic: true
};

var poly = new google.maps.Polyline(polylineopts);

working example 工作实例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM