export default {
excel(data, fileName) {
this.download0(data, fileName, 'application/vnd.ms-excel');
},
word(data, fileName) {
this.download0(data, fileName, 'application/msword');
},
zip(data, fileName) {
this.download0(data, fileName, 'application/zip');
},
html(data, fileName) {
this.download0(data, fileName, 'text/html');
},
markdown(data, fileName) {
this.download0(data, fileName, 'text/markdown');
},
download0(data, fileName, mineType) {
let blob = new Blob([data], {type: mineType});
window.URL = window.URL || window.webkitURL;
let href = URL.createObjectURL(blob);
let downA = document.createElement("a");
downA.href = href;
downA.download = fileName;
downA.click();
window.URL.revokeObjectURL(href);
},
}