我创建了一个小型演示,其中实例化了主干视图并使用this.$el.jScrollPane()
,jScrollPane
附加到它。
当我在 5 秒后重新渲染视图时,jScrollPane
消失了。有谁知道为什么?
在这里,我复制了 js:
var ScrollableView = Backbone.View.extend({
initialize: function() {
this.render();
},
render: function () {
this.$el.html(_.template($('#scrollable_template').html(), {}));
this.$el.jScrollPane();
return this;
}
});
$(function () {
var scrollableView = new ScrollableView({ el: $('#scrollable') });
setTimeout(function() {
scrollableView.render();
console.log("re-rendered");
}, 5000);
});