//通过传递路径将文件下载到此页面的功能
function download (src : string ) var$a=document.createelement ) ' a ); $a.setattribute('href ',src ); $a.setattribute('download ',' test.jpg ' ); $a.setattribute('target ',' _parent ' ); varevobj=document.create event (mouse events ); evobj.initmouseevent('click ',true,true,window,0,0,0,false,false,false,false,false,false,0,null ) $a.dispatchevent(EVobj ); (; 我想用save as的东西,但是不能。 因为跨越域很麻烦,所以使用了最low的方法,但是非常容易使用