<template>
|
<div class="header-container">
|
<div class="logo">
|
<!-- <img src="../assets/vue.svg" alt="logo" /> -->
|
<span>基于状态驱动的机构测试系统 </span>
|
</div>
|
<el-menu
|
mode="horizontal"
|
:default-active="seleStore.curTab"
|
class="header-menu"
|
router
|
>
|
<!-- <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 in navList"
|
:key="item.path"
|
:index="item.path"
|
@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";
|
import { curStoreInfo } from "@/store/index";
|
|
const router = useRouter();
|
const emit = defineEmits(["selectMenu"]);
|
const activeIndex = ref("model");
|
const seleStore = curStoreInfo();
|
const navList = ref([
|
{
|
name: "模型管理",
|
path: "model",
|
},
|
{
|
name: "可视化仿真",
|
path: "simulation",
|
},
|
{
|
name: "系统管理",
|
path: "systemManage",
|
},
|
]);
|
|
const handleSelect = (path: string) => {
|
console.log(path);
|
activeIndex.value = path;
|
// emit("selectMenu", path);
|
router.push("/" + path);
|
seleStore.setCurTab(path)
|
};
|
|
const handleUserClick = () => {
|
router.push("/user/profile");
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.header-container {
|
display: flex;
|
align-items: center;
|
height: 100%;
|
padding: 0 20px;
|
|
.logo {
|
display: flex;
|
align-items: center;
|
margin-right: 40px;
|
|
img {
|
height: 32px;
|
margin-right: 10px;
|
}
|
|
span {
|
font-size: 20px;
|
font-weight: bold;
|
color: #303133;
|
}
|
}
|
|
.header-menu {
|
flex: 1;
|
border-bottom: none;
|
background-color: transparent;
|
}
|
|
.header-right {
|
margin-left: 20px;
|
|
.user-info {
|
display: flex;
|
align-items: center;
|
cursor: pointer;
|
|
.el-avatar {
|
margin-right: 8px;
|
}
|
|
span {
|
color: #303133;
|
}
|
}
|
}
|
}
|
|
:deep(.el-menu--horizontal) {
|
border-bottom: none;
|
}
|
|
:deep(.el-menu-item) {
|
color: #303133;
|
margin: 0 20px !important;
|
|
&:hover {
|
color: #303133;
|
}
|
}
|
</style>
|