初始
This commit is contained in:
50
src/components/Header.vue
Normal file
50
src/components/Header.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user