伙计们,我正在尝试从子视图访问主干视图的属性(不知道是否是正确的面额)。无论如何,这是一些代码:
App.Views.ViewEditGuest = Backbone.View.extend({
el: '#main-content .container_12',
totalPayments: 0,
totalBought: 0,
template: _.template( App.Templates.ViewEditGuest ),
events: {
'click #sell' : 'sell'
},
sell: Backbone.View.extend({
el: '#consumos',
template: _.template( App.Templates.VEGConsumos ),
render: function(){
// I need to acces ViewEditGuest's totalPayments and
// totalBought
this.$el.html( this.template() );
return this;
}
}),
render: function(){
this.$el.html( this.template( ) );
return this;
}
});
所以,我需要通过 sell 的 render 方法访问 ViewEditGuest 的 totalPayments 和 totalBought。我一直在寻找,但找不到任何解决方案。
有任何想法吗?
谢谢!