From 7f199d396989b430f625c152df5c5da708ed86ec Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期三, 30 四月 2025 14:46:55 +0800 Subject: [PATCH] homemenu click --- src/pages/pdf/PdfPreview.vue | 8 +++++--- src/components/pdf/PdfViewerFull.vue | 4 +++- src/global.d.ts | 0 src/components/HeaderMenu.vue | 39 +++++++++++++++++---------------------- tsconfig.json | 1 + 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/components/HeaderMenu.vue b/src/components/HeaderMenu.vue index 3342123..97eff93 100644 --- a/src/components/HeaderMenu.vue +++ b/src/components/HeaderMenu.vue @@ -5,31 +5,15 @@ <img src="@/assets/logo/logo.png" alt="云游四方" class="logo" /> <span class="text-xl font-bold">云游四方</span> </a> - <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" - aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> + <!-- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" + aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation" > + <span class="navbar-toggler-icon"></span> + </button> --> + <button class="navbar-toggler btn-sm" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" + aria-controls="navbarNav" aria-expanded="false" aria-label="导航菜单" ref="navbarToggler"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> - <!-- <ul class="navbar-nav"> - <li class="nav-item"> - <a - class="nav-link active" - aria-current="page" - href="#" - @click.prevent="navigateTo('/')" - >首页</a - > - </li> - <li class="nav-item"> - <a class="nav-link" href="#" @click.prevent="navigateTo('/product')" - >产品中心</a - > - </li> - <li class="nav-item"> - <a class="nav-link" href="#" @click.prevent="navigateTo('/about#third-other')" - >关于我们</a> - </li> - </ul> --> <ul class="navbar-nav"> <li v-for="item in navItems" :key="item.label" class="nav-item"> <a class="nav-link" href="#" :class="{ active: isActive(item.path) }" @@ -48,6 +32,7 @@ </template> <script setup> +import { ref } from 'vue'; import { useRouter, useRoute } from "vue-router"; const router = useRouter(); @@ -68,6 +53,9 @@ // 可根据需要改为更精确的匹配逻辑 return route.fullPath === targetPath || route.path === targetPath.split('#')[0]; }; + +// navbarToggler 引用,用于手动触发点击事件 +const navbarToggler = ref(null); const navigateTo = (path) => { if (path.includes('#')) { const [basePath, hash] = path.split('#'); @@ -75,8 +63,15 @@ } else { router.push(path); } + if (navbarToggler.value) { + navbarToggler.value.click(); + } + }; + + + </script> <style scoped> diff --git a/src/components/pdf/PdfViewerFull.vue b/src/components/pdf/PdfViewerFull.vue index d26a04d..07e2992 100644 --- a/src/components/pdf/PdfViewerFull.vue +++ b/src/components/pdf/PdfViewerFull.vue @@ -1,7 +1,7 @@ <template> <div class="pdf-full-view"> <div v-for="(item, index) in canvases" :key="index" class="pdf-page"> - <canvas :ref="el => canvasRefs[index] = el"></canvas> + <canvas :ref="el => canvasRefs[index] = el" style="width: 100%;"></canvas> </div> </div> </template> @@ -50,9 +50,11 @@ <style scoped> .pdf-full-view { text-align: center; + width: 100%; } .pdf-page { margin-bottom: 20px; + width: 100%; } </style> diff --git a/src/shims-bootstrap.d.ts b/src/global.d.ts similarity index 100% rename from src/shims-bootstrap.d.ts rename to src/global.d.ts diff --git a/src/pages/pdf/PdfPreview.vue b/src/pages/pdf/PdfPreview.vue index 4bd796a..b6d9714 100644 --- a/src/pages/pdf/PdfPreview.vue +++ b/src/pages/pdf/PdfPreview.vue @@ -43,12 +43,14 @@ <h1 class="fw-bold">{{ projectInfo.name }}</h1> <div class="d-flex justify-content-center align-items-center d-none d-md-flex" > <!-- 动态加载组件 --> - <PdfViewerFull v-if="pdfUrl" class="" :src="pdfUrl" :scale="1.0" /> + <PdfViewerFull v-if="pdfUrl" style="width: 60%;" :src="pdfUrl" :scale="1.0" /> </div> - <div class="w-100 d-flex justify-content-center align-items-center d-block d-md-none" > + <div class="w-100 d-flex justify-content-center align-items-center d-block d-md-none main-layout" > <!-- <PdfViewerFull v-if="pdfUrl" style="width: 100%;" :src="pdfUrl" :scale="1.0" /> --> - <PdfViewer v-if="pdfUrl" :src="pdfUrl" :scale="0.8" /> + <!-- <PdfViewer v-if="pdfUrl" :src="pdfUrl" :scale="0.8" /> --> + <PdfViewerFull v-if="pdfUrl" style="width: 90%; ":src="pdfUrl" :scale="1.0" /> + </div> </div> diff --git a/tsconfig.json b/tsconfig.json index a9dbcf3..4a277dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "types": ["vite/client", "webpack-env"], "target": "esnext", "module": "esnext", "moduleResolution": "node", -- Gitblit v1.9.3