feat: 建立Vue3前端框架
This commit is contained in:
62
frontend/src/layouts/AdminLayout.vue
Normal file
62
frontend/src/layouts/AdminLayout.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Box,
|
||||
Collection,
|
||||
DataBoard,
|
||||
Document,
|
||||
Files,
|
||||
Grid,
|
||||
} from '@element-plus/icons-vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { useAppStore } from '@/stores/app';
|
||||
|
||||
const route = useRoute();
|
||||
const appStore = useAppStore();
|
||||
|
||||
const pageTitle = computed(() => String(route.meta.title ?? 'Common Agent'));
|
||||
|
||||
const menuItems = [
|
||||
{ path: '/dashboard', label: '工作台', icon: DataBoard },
|
||||
{ path: '/system/enums', label: '系统枚举', icon: Grid },
|
||||
{ path: '/system/attachments', label: '附件管理', icon: Files },
|
||||
{ path: '/rag/stores', label: '知识库', icon: Collection },
|
||||
{ path: '/rag/documents', label: '知识文档', icon: Document },
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-container class="admin-layout">
|
||||
<el-aside class="admin-sidebar" width="232px">
|
||||
<div class="brand">
|
||||
<el-icon :size="24">
|
||||
<Box />
|
||||
</el-icon>
|
||||
<span>Common Agent</span>
|
||||
</div>
|
||||
|
||||
<el-menu class="side-menu" :default-active="$route.path" router>
|
||||
<el-menu-item v-for="item in menuItems" :key="item.path" :index="item.path">
|
||||
<el-icon>
|
||||
<component :is="item.icon" />
|
||||
</el-icon>
|
||||
<span>{{ item.label }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-container>
|
||||
<el-header class="admin-header">
|
||||
<div>
|
||||
<h1>{{ pageTitle }}</h1>
|
||||
<p>{{ appStore.environmentName }}</p>
|
||||
</div>
|
||||
</el-header>
|
||||
|
||||
<el-main class="admin-main">
|
||||
<RouterView />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
Reference in New Issue
Block a user