在融合 table 上对图标应用样式时,得到意外的标识符

when applying styles to icons on fusion table, getting unexpected identifier

有一张我使用 Google 地图 API 和 Fusion Tables 制作的地图。我正在尝试更改地图上标记的外观。

当我添加 "styles" 时,https://developers.google.com/maps/documentation/javascript/fusiontableslayer 我的地图不会加载到页面上,并且我在控制台中收到错误消息:"unexpected identifier - styles"

谁能帮我弄清楚我做错了什么?

这是我的代码:

var map, layer;
var geocoder;

function initialize(location) {

  console.log(location);
  geocoder = new google.maps.Geocoder();
  var userlocation = new google.maps.LatLng(location.coords.latitude, location.coords.longitude);

  map = new google.maps.Map(document.getElementById('map-canvas'), {
    center: userlocation,
    zoom: 8
  });

  layer = new google.maps.FusionTablesLayer({
    query: {
      select: '\'Geocodable address\'',
      from: '1x265dMvUClEGEVHD_3VRBvSRXk-mbs4jcO2xy29K',
    }
    styles: [
   {markerOptions:{ iconName:"star"}}
  ]                                        
  });
  layer.setMap(map);
}

function codeAddress() {
  var address = document.getElementById('address').value;
  geocoder.geocode( { 'address': address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      map.setCenter(results[0].geometry.location);
    } else {
      alert('Geocode was not successful for the following reason: ' + status);
    }
  });
}

navigator.geolocation.getCurrentPosition(initialize);

我相信你在 styles

之前少了一个逗号
layer = new google.maps.FusionTablesLayer({
    query: {
      select: '\'Geocodable address\'',
      from: '1x265dMvUClEGEVHD_3VRBvSRXk-mbs4jcO2xy29K',
    }, //need a comma here
    styles: [{...

您在样式前少了一个“,”:

layer = new google.maps.FusionTablesLayer({
    query: {
      select: '\'Geocodable address\'',
      from: '1x265dMvUClEGEVHD_3VRBvSRXk-mbs4jcO2xy29K',
    },
    styles: [
   {markerOptions:{ iconName:"star"}}
  ]                                        
});