我正在尝试结合 requirejs/backbone/underscore/jquery 添加幻灯片(http://tutorialzine.com/2009/11/beautiful-apple-gallery-slideshow/)。我的工作基于在以下位置找到的教程:http: //backbonetutorials.com/organizing-backbone-using-modules/ 我的问题是幻灯片脚本已加载但未在模板中执行。有线的事情是,如果页面被刷新,它就可以工作。我可能错过了一些东西,但不知道是什么。
define([
'jquery',
'underscore',
'backbone',
'text!templates/test/list.html',
'slideshow',
], function($, _, Backbone, testListTemplate, script){
var testListView = Backbone.View.extend({
el: $("#page"),
initialize: function(){
},
render: function(){
var data = {};
var compiledTemplate = _.template( testListTemplate, data );
this.el.html( compiledTemplate);
}
});
return new testListView;
});