LoongPanel-Asp/web/components/shell/TitleBar.vue

93 lines
1.9 KiB
Vue
Raw Normal View History

2024-06-22 10:54:02 +08:00
<script lang="ts" setup>
import {useMainLayoutStore} from "~/strores/UseMainLayoutStore";
2024-07-23 12:51:10 +08:00
import {Signature} from 'lucide-vue-next';
2024-06-22 10:54:02 +08:00
2024-07-02 14:28:15 +08:00
const router = useRouter()
2024-07-23 12:51:10 +08:00
const routes = computed(() => {
const route = router.currentRoute.value.name as string
2024-07-02 14:28:15 +08:00
return route.split('-').map(x => {
2024-07-22 18:41:15 +08:00
return x.charAt(0).toUpperCase() + x.slice(1)
2024-07-02 14:28:15 +08:00
})
})
2024-07-23 12:51:10 +08:00
type menuType = {
[key: string]: string;
}
const menus: menuType = {
'Home': '概览',
'Host': '主机',
'Cpu': '处理器',
'Network': '网络',
'ServerUser': '用户监测',
'Id': '用户',
'User': '账号管理',
'InspectionRecords': '巡检记录',
'Settings': '设置'
}
const getMenuInfo = (key: string) => {
return menus[key] ?? key
}
const value = ref()
2024-07-22 18:41:15 +08:00
const options = ref(['@gmail.com', '@outlook.com', '@yahoo.com'])
2024-06-22 10:54:02 +08:00
</script>
<template>
<section class="title-bar-layout">
2024-07-23 12:51:10 +08:00
<n-breadcrumb separator=">">
<n-breadcrumb-item v-for="i in routes" :key="i">
{{ getMenuInfo(i) }}
</n-breadcrumb-item>
</n-breadcrumb>
<div>
</div>
2024-07-22 18:41:15 +08:00
<n-auto-complete
v-model:value="value"
:input-props="{
autocomplete: 'disabled',
}"
:options="options"
placeholder="搜索"
clearable
/>
2024-06-22 10:54:02 +08:00
<div class="user">
<UserMini/>
</div>
</section>
</template>
<style lang="scss" scoped>
@import "base";
.title-bar-layout {
grid-area: titlebar;
background: $light-bg-color;
display: grid;
grid-template-columns: auto 1fr auto auto;
grid-template-rows: 1fr;
align-items: center;
2024-07-22 21:05:18 +08:00
padding: 0 $padding*2;
border-bottom: $border;
2024-06-22 10:54:02 +08:00
gap: $gap*2;
2024-07-02 14:28:15 +08:00
@include SC_Font();
2024-07-23 12:51:10 +08:00
2024-06-22 10:54:02 +08:00
.dark-mode & {
background: $dark-bg-color;
2024-07-22 21:05:18 +08:00
border-bottom: $border-dark;
2024-06-22 10:54:02 +08:00
}
}
2024-07-23 12:51:10 +08:00
:deep(.n-breadcrumb) {
ul {
2024-07-22 18:41:15 +08:00
display: flex;
padding: 0;
align-content: center;
2024-07-23 12:51:10 +08:00
li > span {
2024-07-22 18:41:15 +08:00
font-size: 16px;
font-weight: 800;
}
}
}
2024-06-22 10:54:02 +08:00
</style>