我正在使用Backbone.js来管理我的观点。我像这样扩展Backbone.View:
My.Views.PieChart = Backbone.View.extend({
chartId: '',
plot: {},
params: {},
legendLocation: 's', // default value
...
render: function() {
console.log(this.legendLocation);
}
});
然后我再次扩展PieChart以获取特定对象。
My.Views.GenderChart = My.Views.PieChart.extend({
chartId: 'gender',
el: '#gender',
legendPosition: 'e'
});
然而,当我调用GenderChart.render()时,GenderChart.legendPosition仍然是's'?
由于
答案 0 :(得分:1)
legendLocation
和legendPosition
,还是想要覆盖超类中的legendLocation
键?