Commit 344c5474 by 汤强勇

边侧栏调整

parent f2bd423a
<template lang='pug'> <template lang='pug'>
.sidebar-wrapper .sidebar-wrapper
.control(':class'="{open:unfold,close:!unfold}") .control(':class'="{open:unfold,close:!unfold}")
.sidebar .sidebar('@mouseover'="showUnfoldBtn()",'@mouseout'="hiddenUnfoldBtn()")
.logo .logo
img(':src'="logo") img(':src'="logo")
.item('v-for'="(item,itemIndex) in menuList" ,':key'="item.id",'@click'='choseMenu(item,itemIndex)',':class'="{active:currentMenusIndex === itemIndex}") .item('v-for'="(item,itemIndex) in menuList" ,':key'="item.id",'@click'='choseMenu(item,itemIndex)',':class'="{active:currentMenusIndex === itemIndex}")
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
':sort':'item.sort' ':sort':'item.sort'
}) })
transition(name="fade",mode="out-in",appear) transition(name="fade",mode="out-in",appear)
.childrens-meuns('v-if'="unfold") .childrens-meuns('v-show'="unfold",'v-if'="currentMenus")
.children-item('v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)") .children-item('v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)")
el-menu&attributes({ el-menu&attributes({
'default-active':"2", 'default-active':"2",
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
template template
el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",'@click'="choseSubChildren(i)") el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",'@click'="choseSubChildren(i)")
span.menu-item-name {{i.name}} span.menu-item-name {{i.name}}
.arrow-tip(':class'="{'left-l':!unfold,'left-ll':unfold}",'@click'="toggleUnfold()") .arrow-tip(':class'="{'left-l':!unfold,'left-ll':unfold}",'@click'="toggleUnfold()",'v-show'="unfoldBtn")
img(class='icon-arrow',':class'="{right:!unfold}","src"='@/assets/images/sidebar/left-arrow-gray.png') img(class='icon-arrow',':class'="{right:!unfold}","src"='@/assets/images/sidebar/left-arrow-gray.png')
</template> </template>
<script> <script>
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
logo, logo,
unfold: false, // 水平展开 unfold: false, // 水平展开
menus: [], menus: [],
unfoldBtn: false, // 展开按钮
currentMenus: null, currentMenus: null,
currentMenusIndex: -1, currentMenusIndex: -1,
menuList: [] menuList: []
...@@ -79,14 +80,24 @@ export default { ...@@ -79,14 +80,24 @@ export default {
this.currentMenus = item this.currentMenus = item
this.currentMenusIndex = itemIndex this.currentMenusIndex = itemIndex
if (!this.unfold) { if (!this.unfold) {
this.unfold = true this.toggleUnfold(true)
} }
}, },
selectItemMenu (...args) { selectItemMenu (...args) {
console.log(args) console.log(args)
}, },
toggleUnfold () { toggleUnfold (...args) {
this.unfold = !this.unfold if (!args.length) {
this.unfold = !this.unfold
} else {
this.unfold = args[0]
}
},
hiddenUnfoldBtn () {
this.unfoldBtn = false
},
showUnfoldBtn () {
this.unfoldBtn = true
}, },
choseSubChildren (...args) { choseSubChildren (...args) {
console.log(args) console.log(args)
......
...@@ -31,12 +31,9 @@ export default { ...@@ -31,12 +31,9 @@ export default {
.content-box .content-box
position absolute position absolute
display inline-block display inline-block
/*left 260px*/
/*right 0*/
top 70px top 70px
bottom 0 bottom 0
width 80% width 80%
/*overflow-y scroll*/
-webkit-transition left 0.3s ease-in-out -webkit-transition left 0.3s ease-in-out
transition left 0.3s ease-in-out transition left 0.3s ease-in-out
background #F3F2F8 background #F3F2F8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment