Browse Source

动态控制头部菜单

songxy 4 days ago
parent
commit
ee8a11f718
1 changed files with 14 additions and 3 deletions
  1. 14 3
      CYZZ-master/cyzz/web_cyzz/src/App.vue

+ 14 - 3
CYZZ-master/cyzz/web_cyzz/src/App.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="app">
-    <div class="header">
+    <div class="header" v-if="isShowNav">
       <home-header />
     </div>
-    <div class="content">
+    <div class="content" :class="{'hideNav': !isShowNav}">
       <a-config-provider :locale="locale">
         <a-style-provider hash-priority="high">
           <router-view />
@@ -15,7 +15,7 @@
 
 <script setup>
 import { RouterView } from 'vue-router';
-import { onBeforeMount, ref } from 'vue';
+import { onBeforeMount, onMounted, ref } from 'vue';
 import { setLocalStorageWithExpiry, getLocalStorageWithExpiry } from '@/utils/store.js'
 import zhCN from 'ant-design-vue/es/locale/zh_CN';
 import dayjs from 'dayjs';
@@ -31,6 +31,13 @@ onBeforeMount(() => {
 })
 const route = useRoute();
 const router = useRouter();
+const isShowNav = ref(true)
+watch(() => route.query, (newQuery) => {
+  // 从 newQuery 中提取参数
+  if (newQuery.isnav === '0') {
+    isShowNav.value = false
+  }
+}, { immediate: true });
 const foundHandle = () => {
   router.push({
     name: '404'
@@ -38,6 +45,7 @@ const foundHandle = () => {
 }
 const ticketStr = ref()
 const getUrlParamByToken = () => {
+
   if (!window?.AppGlobalConfig?.authorization?.enabled) return;
   const routePath = route.path
   if (routePath.indexOf('404') !== -1) { return }
@@ -126,6 +134,9 @@ $header_height: 60px;
   }
   >.content {
     height: calc(100% - $header_height);
+    &.hideNav {
+      height: 100%;
+    }
   };
 }
 </style>