Browse Source

优化菜单栏

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

18
src/components/Sidebar.vue

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

Loading…
Cancel
Save