安虹睿
1 year ago
2 changed files with 67 additions and 10 deletions
@ -0,0 +1,60 @@ |
|||
<template> |
|||
<div class="dashboardPage"> |
|||
<el-tree |
|||
:data="navList" |
|||
:props="defaultProps" |
|||
@node-click="goPage" |
|||
></el-tree> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
export default { |
|||
name: 'Dashboard', |
|||
data() { |
|||
return { |
|||
navList:[], |
|||
defaultProps: { |
|||
children: 'children', |
|||
label: 'title' |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
...mapGetters([ |
|||
'permission_routes' |
|||
]) |
|||
}, |
|||
mounted(){ |
|||
this.initData(this.permission_routes) |
|||
}, |
|||
methods:{ |
|||
initData(data){ |
|||
data.forEach(item => { |
|||
if(item.path !== '/' && item.meta) { |
|||
let _item = { |
|||
title:item.meta.title, |
|||
name:item.name, |
|||
path:item.path, |
|||
children:item.children |
|||
} |
|||
this.navList.push(_item) |
|||
} |
|||
if(item.children){ |
|||
this.initData(item.children) |
|||
} |
|||
}) |
|||
}, |
|||
goPage(item){ |
|||
this.$router.push({name: item.name}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.dashboardPage{ |
|||
padding:30px 10px; |
|||
background: #fff; |
|||
} |
|||
</style> |
Loading…
Reference in new issue