我收到了一个'Missing itemViewContainer'错误,我并不期待。我的模块如下所示:木偶:意外失踪itemViewContainer
@App.module 'InstagramApp.List', (List, App, Backbone, Marionette, $, _) ->
class List.ItemView extends Marionette.ItemView
template: '#instagram_item_template'
class List.CompositeView extends Marionette.CompositeView
el: '#bb-instagram'
className: 'large-3 medium-6 columns projects__project'
events:
'click .js-next-photo': 'handleNextClick'
'click .js-prev-photo': 'handlePrevClick'
handleNextClick: (e) ->
e.preventDefault()
console.log 'next photo'
handlePrevClick: (e) ->
e.preventDefault()
console.log 'previous photo'
template: '#instagram_list_template'
itemView: List.ItemView
itemViewContainer: '#bb-photos-container'
而且我的模板看起来像这样:
<script id="instagram_list_template" type="text/template">
<div class="bg-pattern photos">
<div class="photos__inner">
<h4 class="photos__header">I.Instagram</h4>
<div id="bb-photos-container"></div>
<a href="#" class="photos__button photos__button--next js-next-photo"><img src="/assets/img/vendor/photos-btn-next.png" alt=""></a>
<a href="#" class="photos__button photos__button--prev js-prev-photo"><img src="/assets/img/vendor/photos-btn-prev.png" alt=""></a>
</div>
</div>
</script>
所以我#bb-photos-container
元素显然是定义...有什么想法,什么是怎么回事?
我在这里称之为:
@App.module 'InstagramApp.List', (List, App, Backbone, Marionette, $, _) ->
List.Controller =
listPhotos: ->
photos = App.request 'photo:entities'
instagramView = new List.CompositeView({ collection: photos })
$('#bb-projects-list').append(instagramView.render())