feat: add PDF + download btn
This commit is contained in:
parent
cb3d8a49e9
commit
7671a71141
17 changed files with 9 additions and 4 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue