モデルで実行する特定のアイテム (モデル) に対して 2 つのビューを作成する必要がある Marionette.CollectionView があります。Marionette.CollectionView.buildItemView は 2 つのビューを返すことができますか?
編集:
別の WrapperItemView を作成したくありません。すでにいくつかのソリューションを現在実行していますが、それをより標準的なものにしたいと考えています。
コードをこのようにしたいのですが、それを機能させる簡単な方法はありますか?
buildItemView: function(item){
// create 2 views based on item type
return [view1, view2];
},
appendHtml: function(collectionView, itemView, index){
if (itemView.type === "X" )
collectionView.$el.find(".A").append(itemView.el);
if (itemView.type === "Y" )
collectionView.$el.find(".B").append(itemView.el);
}