parent
aaeba22f66
commit
6762d22d8e
@ -0,0 +1,114 @@
|
|||||||
|
<template>
|
||||||
|
<aside class="sidebar">
|
||||||
|
<div class="sidebar-header">
|
||||||
|
<h2 class="logo">RuoYi</h2>
|
||||||
|
</div>
|
||||||
|
<nav class="sidebar-menu">
|
||||||
|
<div
|
||||||
|
v-for="item in menuItems"
|
||||||
|
:key="item.path"
|
||||||
|
class="menu-item"
|
||||||
|
:class="{ active: currentPath === item.path }"
|
||||||
|
@click="navigate(item.path)"
|
||||||
|
>
|
||||||
|
<el-icon v-if="item.icon">
|
||||||
|
<component :is="item.icon" />
|
||||||
|
</el-icon>
|
||||||
|
<span class="menu-text">{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import {
|
||||||
|
HomeFilled,
|
||||||
|
Setting,
|
||||||
|
User,
|
||||||
|
Menu,
|
||||||
|
Document,
|
||||||
|
} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const currentPath = ref(route.path)
|
||||||
|
|
||||||
|
const menuItems = [
|
||||||
|
{ path: '/dashboard', name: '仪表盘', icon: HomeFilled },
|
||||||
|
{ path: '/system', name: '系统管理', icon: Setting },
|
||||||
|
{ path: '/monitor', name: '系统监控', icon: Menu },
|
||||||
|
{ path: '/log', name: '日志管理', icon: Document },
|
||||||
|
{ path: '/user', name: '用户管理', icon: User },
|
||||||
|
]
|
||||||
|
|
||||||
|
function navigate(path: string) {
|
||||||
|
currentPath.value = path
|
||||||
|
router.push(path)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
height: 100vh;
|
||||||
|
background: var(--bg1);
|
||||||
|
border-right: 1px solid var(--bd);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
transition: width var(--transition-normal);
|
||||||
|
|
||||||
|
.sidebar-header {
|
||||||
|
height: var(--header-height);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 16px;
|
||||||
|
border-bottom: 1px solid var(--bd);
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--blu);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-menu {
|
||||||
|
flex: 1;
|
||||||
|
padding: 8px 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--t2);
|
||||||
|
transition: all var(--transition-fast);
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--bg3);
|
||||||
|
color: var(--t1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: rgba(88, 166, 255, 0.1);
|
||||||
|
color: var(--blu);
|
||||||
|
border-left: 3px solid var(--blu);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-text {
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export function useTheme() {
|
||||||
|
const isDark = ref(true)
|
||||||
|
|
||||||
|
function toggleTheme() {
|
||||||
|
isDark.value = !isDark.value
|
||||||
|
document.documentElement.setAttribute('theme', isDark.value ? 'dark' : 'light')
|
||||||
|
}
|
||||||
|
|
||||||
|
return { isDark, toggleTheme }
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
// Global styles (variables.scss is auto-imported via vite.config.ts additionalData)
|
||||||
|
|
||||||
|
// 全局样式
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background-color: var(--bg0);
|
||||||
|
color: var(--t1);
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 滚动条样式
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--bd);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: var(--bg1);
|
||||||
|
}
|
||||||
Loading…
Reference in new issue