File size: 2,573 Bytes
81d8726 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | <template>
<div class="aside_container">
<div class="logo_wrap" @click="toggleMenuPosition">
<img src="/logo_v2_01.png" alt="logo">
<Transition name="el-fade-in-linear">
<h1 v-show="!menuCollapse">EasyNode</h1>
</Transition>
</div>
<MenuList />
<div class="aside_footer">
<div class="theme_switch">
<el-switch
v-model="isDark"
inline-prompt
:active-icon="Moon"
:inactive-icon="Sunny"
class="dark_switch"
/>
</div>
<div class="collapse" @click="handleCollapse">
<el-icon v-if="menuCollapse"><Expand /></el-icon>
<el-icon v-else><Fold /></el-icon>
</div>
</div>
</div>
</template>
<script setup>
import { getCurrentInstance, computed } from 'vue'
import { Expand, Fold, Moon, Sunny } from '@element-plus/icons-vue'
import MenuList from './menuList.vue'
const { proxy: { $store } } = getCurrentInstance()
let menuCollapse = computed(() => $store.menuCollapse)
const isDark = computed({
get: () => $store.isDark,
set: (isDark) => {
$store.setTheme(isDark)
}
})
const handleCollapse = () => {
$store.setMenuCollapse()
}
const toggleMenuPosition = () => {
const newPosition = 'top' // 从左侧模式切换到顶部模式
$store.setMenuPosition(newPosition)
}
</script>
<style lang="scss" scoped>
.aside_container {
overflow-x: auto;
background-color: #fff;
// width: 180px;
display: flex;
flex-direction: column;
:deep(.el-menu) {
border-right: none;
}
.logo_wrap {
display: flex;
align-items: center;
padding: 15px 0 15px 20px;
cursor: pointer;
img {
height: 30px;
width: 30px;
}
h1 {
font-size: 14px;
background: linear-gradient(to right, #ffc021, #e4d1a1);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 600;
user-select: none;
}
}
.aside_footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: auto;
.theme_switch {
margin-top: auto;
margin-left: auto;
margin-bottom: 10px;
margin-right: 10px;
}
.collapse {
margin-left: auto;
margin-bottom: 10px;
margin-right: 10px;
cursor: pointer;
&:hover {
color: #1890ff;
}
}
}
.logout_wrap {
margin-top: auto;
display: flex;
// justify-content: center;
align-items: center;
padding: 15px 0;
margin-left: 20px;
}
}
</style> |