前端导出json文件
发布日期:2022-03-04 12:48:40 浏览次数:24 分类:技术文章

本文共 669 字,大约阅读时间需要 2 分钟。

saveJsonFile({
name: 'fys'}, rdpCode + '.json')function saveJsonFile(data, filename) {
if(!data) {
layer.msg('无数据', {
icon: 7}) return; } if(!filename) filename = 'console.json' if (typeof data === "object") data = JSON.stringify(data) let blob = new Blob([data], {
type: 'text/json'}) let e = document.createEvent('MouseEvents') let a = document.createElement('a') a.download = filename a.href = window.URL.createObjectURL(blob) a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) a.dispatchEvent(e)}

转载地址:https://blog.csdn.net/qq_44308920/article/details/120955014 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:selecte与checkBox动态选中
下一篇:常用集合算法set_diffierent

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月22日 16时31分32秒