feat: add DOCX + PDF
This commit is contained in:
parent
76411d2ad8
commit
3a23b1c8b5
32 changed files with 12 additions and 2 deletions
|
|
@ -81,9 +81,19 @@ onMounted(async () => {
|
|||
|
||||
const downloadManual = () => {
|
||||
const fileName = route.fullPath.split("/").pop();
|
||||
const pdfUrl = window.location.href.replace("manual/", "documents/") + ".pdf";
|
||||
const origin = window.location.origin;
|
||||
const pathname = window.location.pathname;
|
||||
const url = ref<string>("");
|
||||
if (pathname.includes("manual")) {
|
||||
const pdfUrl = origin + pathname.replace("manual", "documents") + ".pdf";
|
||||
url.value = pdfUrl;
|
||||
} else {
|
||||
const pdfUrl = origin + "/documents" + pathname + ".pdf";
|
||||
url.value = pdfUrl;
|
||||
}
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = pdfUrl;
|
||||
link.href = url.value;
|
||||
link.download = fileName ?? ""; // ชื่อไฟล์ที่ต้องการดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue