当我使用new关键字初始化变量(backbone.js模型)时,它在所有最新的浏览器(chrome和firefox)中工作。 但同样在Firefox41中不起作用
var backboneModel = new BackboneModel();
并且控制台中的错误(仅限firefox41)是
TypeError: BackboneModel is not a constructor
任何线索?
更新
我有成功回拨导致问题。 新的Blob语句
之后出现以下错误SyntaxError: missing ; before statement
at
success: function(model, response){
// Create a new Blob object using the
//response data of the onload object
var blob = new Blob([response], {type: 'text/csv'});
//Create a link element, hide it, direct
//it towards the blob, and then 'click' it programatically
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
//Create a DOMString representing the blob
//and point the link element towards it
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = 'Sample_Report.csv';
//programatically click the link to trigger the download
a.click();
//release the reference to the file by revoking the Object URL
window.URL.revokeObjectURL(url);
}
答案 0 :(得分:2)
您似乎错过了.
var backboneModel = new Backbone.Model()