From d954696a02534a7bacf92950c2caeb7c9d0c03ae Mon Sep 17 00:00:00 2001 From: hehongxing <hehongxing@pc.com> Date: Tue, 30 Nov 2021 09:11:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04.系统编码/Frontend/src/App.vue | 16 +++++++++++++--- .../src/components/MicrowaveRadiation.vue | 2 +- 04.系统编码/Frontend/src/router/index.ts | 14 ++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/04.系统编码/Frontend/src/App.vue b/04.系统编码/Frontend/src/App.vue index cc508d8..68fb416 100644 --- a/04.系统编码/Frontend/src/App.vue +++ b/04.系统编码/Frontend/src/App.vue @@ -1,10 +1,12 @@ <template> -<!-- <Header />--> - <login/> + <Header v-if="showHeader" /> + <!-- <login/> --> <router-view /> </template> <script lang="ts"> + import { reactive, ref, toRefs, watch } from 'vue'; + import { useRouter } from 'vue-router'; import Header from './components/Shared/Header.vue'; import Login from "./components/Login.vue"; @@ -12,7 +14,15 @@ name: 'App', components: {Login, Header }, setup() { - return {} + const router = useRouter(); + const showHeader = ref(false); + watch(() => router.currentRoute.value.path, + (current, prev) => { + showHeader.value = current === "/Login" ? false : true; + } + ); + + return {showHeader} } } </script> diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue index 907a54b..eb6880d 100644 --- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue +++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue @@ -30,7 +30,7 @@ </template> <script lang="ts"> -import { reactive, toRefs } from 'vue' + import { reactive, toRefs } from 'vue' export default { name: 'MicrowaveRadiation', setup() { diff --git a/04.系统编码/Frontend/src/router/index.ts b/04.系统编码/Frontend/src/router/index.ts index 354cd6d..be68b13 100644 --- a/04.系统编码/Frontend/src/router/index.ts +++ b/04.系统编码/Frontend/src/router/index.ts @@ -1,18 +1,8 @@ import {createRouter, createWebHashHistory} from 'vue-router'; const routes: any = [ - { path: '/', redirect: '/MicrowaveRadiation'}, - // { - // path: '/MicrowaveRadiation', - // component: () => import('../components/MicrowaveRadiation/Index.vue'), - // children: [ - // { path: '/MicrowaveRadiation', redirect: '/MicrowaveRadiation/VerticalProfile' }, - // { path: 'VerticalProfile', component: () => import('./../components/MicrowaveRadiation/VerticalProfile.vue') }, - // { path: 'ConvectiveIndex', component: () => import('./../components/MicrowaveRadiation/ConvectiveIndex.vue') }, - // { path: 'TLogP', component: () => import('./../components/MicrowaveRadiation/TLogP.vue') }, - // { path: 'BPInversion', component: () => import('./../components/MicrowaveRadiation/BPInversion.vue') } - // ] - // }, + { path: '/', redirect: '/Login'}, + { path: '/Login', component: () => import('../components/Login.vue') }, { path: '/MicrowaveRadiation', component: () => import('../components/MicrowaveRadiation.vue') }, { path: '/RamanLidar', component: () => import('../components/RamanLidar.vue') }, { path: '/SynergyEvaluation', component: () => import('../components/SynergyEvaluation.vue') },