我读了:
并尝试实现和玩弄它,因为我需要使用自定义叠加层作为视图,并且我已经使用了主干.js
var Label = function(){
Backbone.View.apply(this, arguments);
this.newInit();
};
Label.extend = Backbone.View.extend;
_.extend(Label.prototype, Backbone.View.prototype, google.maps.OverlayView.prototype,{
newInit: function(){
this.setMap(this.options.map);
},
onAdd: function(){...},
onRemove: function(){...},
draw: function(){...}
});
var label_view = new LabelView({map: map});
label_view.bindTo('some_event', {name: 'some_event_occured'});
从我的测试来看,“draw”方法没有被调用,尽管它应该覆盖它。我究竟做错了什么?