1、引入filesaver.js插件;
2、JS:
方法一:var
file =
new
File([
"欢迎访问 hangge.com"
],
"文件导出测试.txt"
, {type:
"text/plain;charset=utf-8"
});
saveAs(file);
方法二:
var
blob =
new
Blob([
"欢迎访问 hangge.com"
], {type:
"text/plain;charset=utf-8"
});
saveAs(blob,
"文件导出测试.txt"
);