我正在尝试修改此示例 http://storelocator.googlecode.com/git/examples/panel.html
javascript代码在这里: https ://gist.github.com/2725336
我遇到困难的方面正在改变这一点:
MedicareDataSource.prototype.FEATURES_ = new storeLocator.FeatureSet(
new storeLocator.Feature('Wheelchair-YES', 'Wheelchair access'),
new storeLocator.Feature('Audio-YES', 'Audio')
);
从一个函数创建 FeatureSet,例如,我有一个解析 JSON 对象的函数
WPmmDataSource.prototype.setFeatures_ = function(json) {
var features = [];
// convert features JSON to js object
var rows = jQuery.parseJSON(json);
// iterate through features collection
jQuery.each(rows, function(i, row){
var feature = new storeLocator.Feature(row.slug + '-YES', row.name)
features.push(feature);
});
return new storeLocator.FeatureSet(features);
};
所以然后将第一个代码片段更改为类似
WPmmDataSource.prototype.FEATURES_ = this.setFeatures_(wpmm_features);
返回错误:
Uncaught TypeError: Object [object Window] has no method 'setFeatures_'