Marionette.js在'Node'上执行'appendChild'失败:参数1不是'Node'types,
这是我的LayoutView:
define(["marionette", "lodash", "text!fonts/template.html", "fonts/controls/view", "fonts/products/view"], function(Marionette, _, templateHTML, ControlsView, ProductsView) { 'use strict'; var FontsView = Marionette.LayoutView.extend({ regions: { controls: '#controls', products: '#products-list' }, template: _.template(templateHTML), onRender: function() { this.getRegion('controls').show(new ControlsView()); this.getRegion('products').show(new ProductsView()); } }); return FontsView; });
这是我的产品查看:
define(["marionette", "lodash", "text!fonts/products/template.html", 'fonts/products/item-view', 'fonts/products/collection'], function(Marionette, _, templateHTML, ProductItemView, ProductsCollection) { 'use strict'; var ProductsView = Marionette.CompositeView.extend({ el: '.items', template: _.template(templateHTML), childView: ProductItemView, initialize: function() { this.collection = new ProductsCollection(); } }); return ProductsView; });
这个错误(从控制台)发生在this.getRegion('products').show(new ProductsView());
从ProductsView删除el: '.items',
它将起作用。 木偶已经在pipe理该地区,并且在儿童视图上指定el时会感到困惑。