naive-ui
Version:
A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast
17 lines (16 loc) • 407 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.download = void 0;
const download = (url, name) => {
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);
};
exports.download = download;