feat: download manual all
This commit is contained in:
parent
32e1bf94a4
commit
1d97fb58b0
2 changed files with 15 additions and 4 deletions
BIN
public/manual-all.pdf
Normal file
BIN
public/manual-all.pdf
Normal file
Binary file not shown.
|
|
@ -43,12 +43,23 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const downloadFile = () => {
|
const downloadManual = () => {
|
||||||
const fileName = route.fullPath.split("/").pop();
|
const fileName = route.fullPath.split("/").pop();
|
||||||
const pdfUrl = window.location.href.split("manual/").join("") + ".pdf";
|
const pdfUrl = window.location.href.split("manual/").join("") + ".pdf";
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = pdfUrl;
|
link.href = pdfUrl;
|
||||||
link.download = `${fileName}.pdf`; // ชื่อไฟล์ที่ต้องการดาวน์โหลด
|
link.download = fileName ?? ""; // ชื่อไฟล์ที่ต้องการดาวน์โหลด
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
};
|
||||||
|
|
||||||
|
const downloadManualAll = () => {
|
||||||
|
const fileName = "manual-all.pdf";
|
||||||
|
const pdfUrl = window.location.origin + "/manual-all.pdf";
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = pdfUrl;
|
||||||
|
link.download = `${fileName}`; // ชื่อไฟล์ที่ต้องการดาวน์โหลด
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
|
@ -96,7 +107,7 @@ const downloadFile = () => {
|
||||||
clickable
|
clickable
|
||||||
class="row items-center no-wrap"
|
class="row items-center no-wrap"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="downloadFile()"
|
@click="downloadManual()"
|
||||||
>
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
color="red"
|
color="red"
|
||||||
|
|
@ -110,7 +121,7 @@ const downloadFile = () => {
|
||||||
clickable
|
clickable
|
||||||
class="row items-center no-wrap"
|
class="row items-center no-wrap"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click=""
|
@click="downloadManualAll()"
|
||||||
>
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
color="red"
|
color="red"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue