在商店定位器中的商店面板中添加新字段google maps api

时间:2016-04-02 18:55:42

标签: javascript google-maps-api-3 prototype

我想在左侧面板中为商店添加新字段。我发现我需要扩展这个原型方法,但我不知道如何去做。

storeLocator.Store.prototype.getInfoWindowContent = function() {
  if (!this.content_) {
    // TODO(cbro): make this a setting?
    var fields = ['title', 'address', 'phone', 'misc', 'web'];
    var html = ['<div class="store">'];
    html.push(this.generateFieldsHTML_(fields));
    html.push(this.generateFeaturesHTML_());
    html.push('</div>');

    this.content_ = html.join('');
  }
  return this.content_;
};

我需要在上面的“字段”列表中添加字段。请帮助。

1 个答案:

答案 0 :(得分:0)

根据您提供的代码,我认为有一个fields变量,您可以在其中包含其他字段。您是否尝试向该阵列添加String值?试一试。

我认为html变量是针对商店定位器的界面。请注意,fields被推送(html.push())到html。

发现此链接显示Simple Customized Store Locator。此外,此Github Store Locator Reference也可能对您有用。

希望这会有所帮助。祝你好运。

相关问题