feat: add PDF + download btn

This commit is contained in:
oat_dev 2024-06-21 17:43:06 +07:00
parent cb3d8a49e9
commit 7671a71141
17 changed files with 9 additions and 4 deletions

View file

@ -42,9 +42,14 @@ onMounted(async () => {
});
const downloadFile = () => {
const fileUrl = route.fullPath + ".pdf";
console.log(route.fullPath);
// window.open(fileUrl);
const fileName = route.fullPath.split("/").pop();
const pdfUrl = window.location.href.split("manual/").join("") + ".pdf";
const link = document.createElement("a");
link.href = pdfUrl;
link.download = `${fileName}.pdf`; //
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
</script>
@ -83,7 +88,7 @@ const downloadFile = () => {
color="primary"
class="q-ml-md"
label="ดาวน์โหลดคู่มือทั้งหมด"
@click="downloadFile()"
@click="console.log('download All')"
/>
<q-btn
size="13px"