From 96be59a64cc1d8fcaf1034e787717663c68df4a7 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期一, 26 五月 2025 10:39:58 +0800 Subject: [PATCH] 2025-5-26提交 --- src/layout/components/header.vue | 37 ++++++++++++++++++++++++++----------- 1 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/layout/components/header.vue b/src/layout/components/header.vue index 38dcd1c..6893969 100644 --- a/src/layout/components/header.vue +++ b/src/layout/components/header.vue @@ -6,49 +6,64 @@ </div> <el-menu mode="horizontal" - :default-active="activeIndex" + :default-active="seleStore.curTab" class="header-menu" router > - <!-- <el-menu-item index="/">妯″瀷绠$悊</el-menu-item> + <!-- <el-menu-item index="/model" >妯″瀷绠$悊</el-menu-item> <el-menu-item index="/simulation">鍙鍖栦豢鐪�</el-menu-item> <el-menu-item index="/systemManage">绯荤粺绠$悊</el-menu-item> --> <el-menu-item - v-for="(item,index) in navList" + v-for="item in navList" :key="item.path" :index="item.path" - @click="handleSelect(item.path, index)" + @click="handleSelect(item.path)" >{{ item.name }}</el-menu-item > </el-menu> + <div class="header-right"> + <div class="user-info" @click="handleUserClick"> + <el-avatar src="path/to/avatar.png"></el-avatar> + <span>鐢ㄦ埛鍚�</span> + </div> + </div> </div> </template> <script setup lang="ts"> import { ref, defineEmits } from "vue"; import { useRoute, useRouter } from "vue-router"; -const router = useRouter(); -const route = useRoute(); +import { curStoreInfo } from "@/store/index"; -const activeIndex = ref("/"); +const router = useRouter(); +const emit = defineEmits(["selectMenu"]); +const activeIndex = ref("model"); +const seleStore = curStoreInfo(); const navList = ref([ { name: "妯″瀷绠$悊", - path: "/model", + path: "model", }, { name: "鍙鍖栦豢鐪�", - path: "/simulation", + path: "simulation", }, { name: "绯荤粺绠$悊", - path: "/systemManage", + path: "systemManage", }, ]); const handleSelect = (path: string) => { + console.log(path); activeIndex.value = path; - router.push(path); + // emit("selectMenu", path); + router.push("/" + path); + seleStore.setCurTab(path) +}; + +const handleUserClick = () => { + router.push("/user/profile"); }; </script> -- Gitblit v1.9.1