@fesjs/fes-design
Version:
fes-design for PC
19 lines (17 loc) • 387 B
JavaScript
function download(_ref) {
let {
href,
name
} = _ref;
const a = document.createElement('a');
a.download = name !== null && name !== void 0 ? name : `${Date.now()}`;
a.href = href;
a.target = '_blank';
a.style.display = 'none';
document.body.append(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
}, 0);
}
export { download as default };