helorui
Version:
Vue3 components library
17 lines (15 loc) • 376 B
JavaScript
export default function()
{
function download(data, filename)
{
const url = window.URL.createObjectURL(new Blob([data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
}
return {
download,
};
}