


























思路很简单,就是利用Blob、URL.createObjectURL()方法和<a> 便签的HTML5新属性download来模拟远端文件下载保存。下面直接上代码
savePath: function(){ var me = this; if(!me.curve){ $.uitools.alertDlg("Path还没有定义,请先定义路径!"); return; } var json = me.pathToJson(); var blob = new Blob([json]); var url = URL.createObjectURL(blob); var a = document.createElement("a"); a.setAttribute('download','path.json'); a.setAttribute('href',url); document.body.appendChild(a); a.click(); a.remove(); },
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。