2024-01-29 09:26:07 +08:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2024-08-02 18:19:39 +08:00
|
|
|
exports.download = download;
|
|
|
|
function download(url, name) {
|
2024-01-29 09:26:07 +08:00
|
|
|
if (!url)
|
|
|
|
return;
|
|
|
|
const a = document.createElement('a');
|
|
|
|
a.href = url;
|
|
|
|
if (name !== undefined) {
|
|
|
|
a.download = name;
|
|
|
|
}
|
|
|
|
document.body.appendChild(a);
|
|
|
|
a.click();
|
|
|
|
document.body.removeChild(a);
|
2024-08-02 18:19:39 +08:00
|
|
|
}
|