我收到“没有方法‘结果’backbone.marionette.js:402 错误”。这是跟踪:
Uncaught TypeError: Object function (obj) { return new wrapper(obj); } has no method 'result' backbone.marionette.js:402
Marionette.CollectionView.Marionette.View.extend.buildItemView backbone.marionette.js:402
Marionette.CollectionView.Marionette.View.extend.addItemView backbone.marionette.js:360
Marionette.CollectionView.Marionette.View.extend.showCollection backbone.marionette.js:314
...
在主干.marionette.js 中:
// Build an `itemView` for every model in the collection.
buildItemView: function(item, ItemView){
var itemViewOptions = _.result(this, "itemViewOptions");
***Uncaught TypeError: Object function (obj) { return new wrapper(obj); } has no method 'result' ***
var options = _.extend({model: item}, itemViewOptions);
var view = new ItemView(options);
return view;
backbone. },
我的调用代码:
MyApp.module("CatalogsApp.Pasteboard", function(Pasteboard, MyApp, Backbone, Marionette, $, _) {
var CatalogListView, CatalogView;
CatalogView = Marionette.ItemView.extend({
tagName: "div",
className: "catalog-cell",
template: "catalogs/catalog"
});
CatalogListView = Marionette.CollectionView.extend({
tagName: "div",
className: "paste-board",
itemView: catalogView
});
Pasteboard.showCatalogs = function(catalogList) {
var catalogListView;
catalogListView = new CatalogListView({
collection: catalogList
});
return MyApp.layout.main.show(catalogListView);
};
});
如果有人有任何线索可能是导致类型错误的问题 - 很高兴得到想法。我快到了,我可以说。catalogList 集合似乎很好 - 从服务器填充。我知道这可能很难破译,但也许有人对如何解决问题有一些想法。