@apneadiving:请帮帮我
在萤火虫中显示错误
类型错误:Gmaps.map 未定义
Gmaps.map.callback = function() {
我遵循了Andy Glass 教程中的所有内容,并停留在这一点上。在我的输出中,我能够看到谷歌地图和标记以及单击标记的一些详细信息。
应用程序.js
Gmaps.map.callback = function() {
var PopulationFilter = {
min: 800000,
max: 10000000
};
$( "#filtered-pop" ).val( (PopulationFilter.min)+ " - " + (PopulationFilter.max))
$("#population-range").slider({
range: true,
min: PopulationFilter.min,
max: PopulationFilter.max,
values: [ PopulationFilter.min, PopulationFilter.max ],
slide: function(event, ui) {
$( "#filtered-pop" ).val( (ui.values[ 0 ])+ " - " + (ui.values[ 1 ]))
PopulationFilter.min = ui.values[ 0 ]
PopulationFilter.max = ui.values[ 1 ]
applyFilters()
}
});
var VisibleMarkers = function() {
var filtered = _.reject(Gmaps.map.markers, function(marker) {
return marker.prop_details < PopulationFilter.min || marker.prop_details > PopulationFilter.max;
});
return filtered
}
var applyFilters = function() {
_.each(Gmaps.map.markers, function(marker) {
Gmaps.map.hideMarker(marker)
})
_.each(VisibleMarkers(), function(marker) {
Gmaps.map.showMarker(marker)
})
};
}