Files
--/src/components/Header.vue
汤凯 6dbbd47caf 1
2025-12-08 17:18:51 +08:00

51 lines
1.0 KiB
Vue

<template>
<div class="bg-transparant">
<a-menu v-model:selectedKeys="current" mode="horizontal">
<a-menu-item v-for="item in departmentList" :key="item.key">
{{ item.name }}
</a-menu-item>
</a-menu>
</div>
</template>
<script setup lang="ts">
import { watch } from "vue";
import { useUserStore } from "@/store/user.ts";
import { useRouter, useRoute } from "vue-router";
let userStore: any = useUserStore();
const router = useRouter();
const current = ref<string[]>(["3"]);
watch(
current,
(N, O) => {
if (N == 5) {
router.push({
path: "/statistic",
});
}
if (N != 5) {
userStore.SetMenuInfo({ key: current.value });
}
},
{
immediate: true,
}
);
let departmentList = [
{ key: "3", name: "人工智能系" },
{ key: "1", name: "电子信息工程系" },
{ key: "2", name: "通信工程系" },
// { key: "4", name: "未知" },
{ key: "5", name: "数据统计" },
];
</script>
<style scoped>
.ant-menu-light {
background-color: transparent;
}
</style>