Browse Source

优化菜单栏

master
ltlzx 4 years ago
parent
commit
0d575e93f2
  1. 32
      src/components/Sidebar.vue

32
src/components/Sidebar.vue

@ -94,19 +94,29 @@ export default {
},
created(){
this.key=this.$route.path
this.items.map(item=>{
if(item.children){
for(let item1 in item.children){
if(item1.key==this.key){
this.openKey=item.key
break
}else{
this.openKey=''
this.key=''
this.showMenu()
},
methods:{
showMenu(){
this.items.map(item=>{
if(item.children){
for(let i in item.children){
let item1=item.children[i]
if(item1.key==this.key){
this.openKey=item.key
break
}
}
}
}
})
})
},
},
watch:{
$route(to,form){
// console.info(to)
// this.key=to.path
// this.showMenu()
}
}
}
</script>

Loading…
Cancel
Save