feat: add DOCX + PDF

This commit is contained in:
oat_dev 2024-07-01 13:49:53 +07:00
parent 76411d2ad8
commit 3a23b1c8b5
32 changed files with 12 additions and 2 deletions

View file

@ -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();