2016-04-02 57 views
0

我想在左側面板中添加商店的新字段。我發現我需要擴展這個原型方法,但我不知道如何去做。在店鋪定位器中添加新的字段谷歌地圖api

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_; 
 
};

我需要添加字段列表中的 「域」 以上。請幫忙。

回答

0

根據你已經提供的代碼,有一個fields變量,我認爲你可以在其中包含額外的字段。您是否嘗試將String值添加到該數組中?試一試。

我認爲html變量是用於商店定位器的接口。請注意,fields被推送(html.push())到html中。

找到此鏈接顯示Simple Customized Store Locator。此外,這Github Store Locator Reference也可能對你有用。

希望這會有所幫助。祝你好運。