From 192357af7905781e3c7973be2120c0c796573fe5 Mon Sep 17 00:00:00 2001 From: youzi <2410633923@qq.com> Date: Tue, 23 Dec 2025 11:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E8=88=AA=E7=BB=84=E4=BB=B6=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 3 ++ src/components/menuH.vue | 12 +++--- src/stores/nav.ts | 2 +- src/util/index.ts | 2 + src/views/Home.vue | 87 ++++++++++++++++++++++++++++++++++++---- vite.config.ts | 4 +- 6 files changed, 94 insertions(+), 16 deletions(-) diff --git a/components.d.ts b/components.d.ts index 0356d63..c786e6f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -28,6 +28,9 @@ declare module 'vue' { DSelect: typeof import('vue-devui/select/index.es.js')['Select'] DTab: typeof import('vue-devui/tabs/index.es.js')['Tab'] DTabs: typeof import('vue-devui/tabs/index.es.js')['Tabs'] + DTag: typeof import('vue-devui/tag/index.es.js')['Tag'] + DTagGroup: typeof import('vue-devui/tag-group/index.es.js')['TagGroup'] + DTags: typeof import('vue-devui/tags/index.es.js')['Tags'] HomeSide: typeof import('./src/components/homeSide.vue')['default'] MenuH: typeof import('./src/components/menuH.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/menuH.vue b/src/components/menuH.vue index 80e71ad..c546d80 100644 --- a/src/components/menuH.vue +++ b/src/components/menuH.vue @@ -117,9 +117,9 @@ const getLocation = () => { break; } const res = await $http.mix.getIp(); - latitude.value = res.data.lat; - longitude.value = res.data.lon; - const jw = `${longitude.value?.toFixed(2)},${latitude.value?.toFixed(2)}`; + latitude.value = Number(res.data.data.lat); + longitude.value = Number(res.data.data.lng); + const jw = `${longitude.value?.toFixed(4)},${latitude.value?.toFixed(4)}`; // 这里可以添加调用后端API获取具体位置名称的逻辑 handdleJw(jw); @@ -214,7 +214,7 @@ onMounted(() => { getLocation(); // 组件挂载时获取位置 const h: number = nav.value.clientHeight - navx.setNavH(h) + if(h>0) navx.setNavH(h) @@ -223,7 +223,9 @@ onBeforeUpdate(() => { userinfo.value = $cookies.get('userinfo'); key.value = route.name as string; const h: number = nav.value.clientHeight - navx.setNavH(h) + // console.log('******>>> --> nav.value:', nav.value) + // console.log('()()()()()>>> --> h:', h) + if(h>0) navx.setNavH(h) }) diff --git a/src/stores/nav.ts b/src/stores/nav.ts index 4b74f07..154541b 100644 --- a/src/stores/nav.ts +++ b/src/stores/nav.ts @@ -1,5 +1,5 @@ export const useNavStore = defineStore('nav', () => { - const navH:Ref = ref(0) + const navH:Ref = ref(56) function setNavH(v:number) { navH.value = v diff --git a/src/util/index.ts b/src/util/index.ts index ed5e714..e56c2eb 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -159,3 +159,5 @@ export function resetObject>(obj: T): void { (obj as Record)[key] = null; }); } + + diff --git a/src/views/Home.vue b/src/views/Home.vue index 1eea199..7ccc7a6 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -12,10 +12,15 @@ + +
+ {{ tag.name }} +
-