function download(src) {
var $a = document.createElement(\'a\');
$a.setAttribute("href", src);
$a.setAttribute("download", "");
var evObj = document.createEvent(\'MouseEvents\');
evObj.initMouseEvent( \'click\', true, true, window, 0, 0, 0, 0, 0, false, false, true, false, 0, null);
$a.dispatchEvent(evObj);
};
该方法从网上找来的,直接调用,使用直接传路径,就可使用