我正在使用backbone.js 来创建应用程序。我的代码JS代码如下,
window.RequestsView = Backbone.View.extend({
initialize:function ( input ) {
console.log('input ' + JSON.stringify(input) );
this.variables = { request_id:input.model.id,
status:input.model.status,
mavenGav:input.model.mavenGav,
email:input.model.emailId,
errorNo:input.model.errorNo,
errorDesc:input.model.errorDesc };
console.log("variables : "+ JSON.stringify( this.variables ) );
this.template = _.template(tpl.get('requests'));
var out = this.template( input );
console.log("out: "+ JSON.stringify( out ) );
// deep copy the object
this.request = $.extend( true, {}, input);
}
});
当我在 chrome 调试器中调试它时,我得到以下日志,
input {"model":{"mavenGav":"fgdfgfdgdfg:fgdfgfd:gdfgdfg","repositories":["dfgdfgdfgf"],"emailId":"gdfg","id":1083,"createdTime":null,"status":"CREATED","errorNo":0,"errorDesc":null}}
requests.js:12variables : {"request_id":1083}
没有错误。分配给 this.variables 的 javascript 文字的其余部分会发生什么?