我正在使用带有 mustache.js 的 Backbone.js,并且正在使用 ajax 加载我的模板。我的问题是模板是从缓存中加载的(如果重要的话,使用 ctrl+F5 刷新!)。现在我对模板进行了更改,但它仍在加载旧版本。它在隐身模式下工作得很好。有没有办法防止这种情况?也许阻止 Mustache 缓存模板?
呈现模板的代码是:
$.get(this.templatesPath + this.template, function(resTemplate){
var html = Mustache.render(resTemplate, that.personData);
that.$el.html(html);
});
我的第一个想法是使用其他函数而不是“Mustache.render()”,比如“Mustache.to_html()”。但是查看源代码会发现 to_html() 只是调用了 render()。
有什么想法吗?