0
我有一個觀點:如何根據骨幹和木偶中的對象更改來更新視圖?
define(['backbone', 'hbs!tmpl/test_tmpl'],
function (Backbone, TestTmpl) {
'use strict';
return Backbone.Marionette.ItemView.extend({
initialize: function() {
this.projects = {};
},
template: TestTmpl,
templateHelpers: function() {
return {
projects: this.projects
}
},
ui: {},
events: {},
onRender: function() {
this.projects = {title: 'a'};
return this;
}
});
});
然後在視圖:在onRender()
方法
{{#each projects}}{{this.title}}{{/each}}
我更新項目this.projects = {title: 'a'};
和設置的時候,我想視圖數據進行更新,以及
有什麼想法?