增加边栏收起功能

main
RogerWork 1 year ago
parent e3602b4b65
commit 779b32d22f
  1. 16
      src/layout/components/PageSiderbar.vue

@ -1,5 +1,11 @@
<template>
<div class="page-sidebar">
<div class="collape-bar">
<el-icon class="cursor" @click="isCollapse = !isCollapse">
<expand v-if="isCollapse"></expand>
<fold v-else></fold>
</el-icon>
</div>
<el-menu :default-active="defaultActive" router class="sidemenu" :collapse="isCollapse">
<el-sub-menu v-for="(item,i) in treeData" :key="i" :index="item.path">
<template #title>
@ -26,6 +32,7 @@ import {menuTreeData} from "@/mock/data.js";
import {useRoute} from "vue-router";
import {useI18n} from "vue-i18n";
import {ref, computed} from "vue";
import {Expand, Fold} from "@element-plus/icons-vue";
const route = useRoute();
@ -57,6 +64,15 @@ $side-width: 200px;
.sidemenu .el-menu:not(.el-menu--colapse) {
width: $side-width;
}
.collape-bar {
color: #ffffff;
font-size: 16px;
line-height: 36px;
text-align: center;
.c-icon {
cursor: pointer;
}
}
}
</style>

Loading…
Cancel
Save