左侧菜单栏收缩放到右侧

This commit is contained in:
yanyizhou
2021-10-22 14:16:21 +08:00
parent 858f215e53
commit 9cdc77656c
2 changed files with 859 additions and 832 deletions
+12 -11
View File
@@ -27,11 +27,11 @@
</el-dropdown> </el-dropdown>
</div> </div>
</div> </div>
<!-- <div class="logo">--> <!-- <div class="logo">-->
<!-- <img :src="logo" />--> <!-- <img :src="logo" />-->
<!-- </div>--> <!-- </div>-->
</div> </div>
<!-- <com-header></com-header>--> <!-- <com-header></com-header>-->
<div class="container-box"> <div class="container-box">
<router-view /> <router-view />
</div> </div>
@@ -41,9 +41,9 @@
</template> </template>
<script> <script>
import {mapGetters, mapState} from 'vuex' import {mapGetters, mapState} from 'vuex'
import { webLoginType } from '@/sysConfig' import { webLoginType } from '@/sysConfig'
export default { export default {
name: 'App', name: 'App',
data () { data () {
return { return {
@@ -277,11 +277,11 @@
clearInterval(this.intervalForLogin) clearInterval(this.intervalForLogin)
clearInterval(this.intervalForHome) clearInterval(this.intervalForHome)
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
#app { #app {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -312,7 +312,8 @@
//flex: 1; //flex: 1;
background: #F4F4F4; background: #F4F4F4;
overflow-y: auto; overflow-y: auto;
padding: 10px 10px 0; padding: 10px 0 10px 0;
//padding: 10px 10px 0;
.pagination { .pagination {
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
width: calc(~'100% - 20px'); width: calc(~'100% - 20px');
@@ -324,5 +325,5 @@
/deep/.el-menu--vertical { /deep/.el-menu--vertical {
background: red; background: red;
} }
} }
</style> </style>
+56 -30
View File
@@ -8,10 +8,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="toggle-btn el-icon-s-fold" v-if="isCollapse === false" style="margin: 10px 0; display: flex;justify-content: center; font-size: 30px; color: #333333;" @click="handleToggleSideBar"> <!-- <div class="toggle-btn el-icon-s-fold" v-if="isCollapse === false" style="margin: 10px 0; display: flex;justify-content: center; font-size: 30px; color: #333333;" @click="handleToggleSideBar">-->
<div style="font-size: 14px; line-height: 30px;">{{ this.isCollapse ? '' : '' }}</div><i class=""></i></div> <!-- <div style="font-size: 14px; line-height: 30px;">{{ this.isCollapse ? '' : '' }}</div><i class=""></i></div>-->
<div class="toggle-btn el-icon-s-unfold" v-else style="margin: 10px 0; display: flex;justify-content: center; font-size: 30px; color: #333333;" @click="handleToggleSideBar"> <!-- <div class="toggle-btn el-icon-s-unfold" v-else style="margin: 10px 0; display: flex;justify-content: center; font-size: 30px; color: #333333;" @click="handleToggleSideBar">-->
<div style="font-size: 14px; line-height: 30px;">{{ this.isCollapse ? '' : '' }}</div></div> <!-- <div style="font-size: 14px; line-height: 30px;">{{ this.isCollapse ? '' : '' }}</div></div>-->
<div class="left-tree"> <div class="left-tree">
<el-menu <el-menu
unique-opened unique-opened
@@ -66,11 +66,16 @@
</template> </template>
</el-menu> </el-menu>
</div> </div>
<div class="tree-collapse" @click="handleToggleSideBar" :class="{ 'tree-close': isCollapse }">
<!--切换折叠样式-->
<i class="el-icon-arrow-left" v-if="isCollapse === false"></i>
<i class="el-icon-arrow-right" v-if="isCollapse === true"></i>
</div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapMutations } from 'vuex' import { mapGetters, mapMutations } from 'vuex'
export default { export default {
name: 'NavMenu', name: 'NavMenu',
data () { data () {
return { return {
@@ -461,6 +466,11 @@
handleToggleSideBar () { handleToggleSideBar () {
this.toggleSideBar(!this.isCollapse) this.toggleSideBar(!this.isCollapse)
}, },
// 收展按钮
collapseIcon() {
return this.sideClose ? 'el-icon-arrow-left' : 'el-icon-arrow-right'
// return 'el-icon-arrow-left'
},
...mapMutations(['toggleSideBar']) ...mapMutations(['toggleSideBar'])
}, },
computed: { computed: {
@@ -482,16 +492,17 @@
} }
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '~@/assets/styles/mixins'; @import '~@/assets/styles/mixins';
.nav-menu { .nav-menu {
width: 58px; width: 58px;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
user-select: none; user-select: none;
box-sizing: border-box; box-sizing: border-box;
position: relative;
background: rgb(255, 255, 255); background: rgb(255, 255, 255);
background-size: 100% 100%; background-size: 100% 100%;
/deep/.el-tooltip { /deep/.el-tooltip {
@@ -518,6 +529,21 @@
} }
} }
} }
.tree-collapse{
position: absolute;
right: 0;
top: 65px;
display: flex;
align-items: center;
justify-content: center;
width: 15px;
height: calc(100% - 69px);
background: #EEE;
cursor: pointer;
&:hover{
background-color: #3391CE;
}
}
.logo{ .logo{
text-align: center; text-align: center;
padding: 15px 0; padding: 15px 0;
@@ -533,37 +559,37 @@
background: #f0f7ff !important; background: #f0f7ff !important;
color: #4091FF !important; color: #4091FF !important;
} }
} }
.has-no-read{ .has-no-read{
position: relative; position: relative;
top:-15px; top:-15px;
left:10px left:10px
} }
.nav-menu /deep/.el-submenu__title i { .nav-menu /deep/.el-submenu__title i {
color: #000; color: #000;
} }
.nav-menu{ .nav-menu{
scrollbar-width: none; scrollbar-width: none;
-ms-overflow-style: none; /* IE 10+ */ -ms-overflow-style: none; /* IE 10+ */
} }
.nav-menu::-webkit-scrollbar { .nav-menu::-webkit-scrollbar {
display: none; /* Chrome Safari */ display: none; /* Chrome Safari */
} }
.nav-menu-popper .el-menu .el-menu-item { .nav-menu-popper .el-menu .el-menu-item {
color: #fff !important; color: #fff !important;
} }
.nav-menu-popper .el-menu .el-menu-item.is-active { .nav-menu-popper .el-menu .el-menu-item.is-active {
background-color: #fff !important; background-color: #fff !important;
color: #5ea9f6 !important; color: #5ea9f6 !important;
font-weight: bold; font-weight: bold;
} }
.nav-menu-popper .el-menu .el-menu-item:hover { .nav-menu-popper .el-menu .el-menu-item:hover {
background-color: #fff !important; background-color: #fff !important;
color: #5ea9f6 !important; color: #5ea9f6 !important;
font-weight: bold; font-weight: bold;
} }
.el-menu-item { .el-menu-item {
padding: 0 16px !important; padding: 0 16px !important;
span { span {
font-weight: normal; font-weight: normal;
@@ -595,8 +621,8 @@
background-image: url("~assets/images/shangqi/sideBar/liucheng.png"); background-image: url("~assets/images/shangqi/sideBar/liucheng.png");
} }
} }
} }
.el-submenu { .el-submenu {
/deep/.el-submenu__title { /deep/.el-submenu__title {
padding: 0 16px !important; padding: 0 16px !important;
span { span {
@@ -639,8 +665,8 @@
/deep/.el-menu { /deep/.el-menu {
padding-left: 18px; padding-left: 18px;
} }
} }
.el-menu--collapse{ .el-menu--collapse{
width: 100%; width: 100%;
.shangqi-icon{ .shangqi-icon{
width: 24px; width: 24px;
@@ -654,5 +680,5 @@
} }
} }
} }
} }
</style> </style>