我正在使用骨干网,当我使用模型作为数组时,我有一个错误,任何人都可以告诉我哪里错了吗?
$(function () {
var Rectangle = Backbone.Model.extend({});
var RectangleView = Backbone.View.extend({
.....
});
var models [
new Rectangle({
width: 100,
height: 60,
position: {
x: 300,
y: 150
},
color: '#ff0000'
})
];
_(models).each(function(rmodel) {
$('div#canvas').append(new RectangleView({ model: rmodel}).render().el);
});
})();
它来自数组
答案 0 :(得分:4)
您错过了=
var models = [
new Rectangle({
width: 100,
height: 60,
position: {
x: 300,
y: 150
},
color: '#ff0000'
})
];