Skip to content

Commit

Permalink
feat: link with store.routes
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed Oct 7, 2018
1 parent 910421b commit c3ba8e1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 70 deletions.
61 changes: 4 additions & 57 deletions src/components/App/RecursiveAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,10 @@
>
<!-- recursive tree area -->
<recursive-list
:basic-route="`/1`"
:route="{
path: '/1',
components: 1,
meta: {
title: '11111',
icon: 'el-icon-tickets'
},
children: [
{
path: '2-1',
components: 2,
meta: {
title: '22222'
},
children: [
{
path: '3-1',
components: 3,
meta: {
title: '33333'
}
},
{
path: '4-1',
components: 4,
meta: {
title: '4444'
},
}
]
},
{
path: '2-2',
components: 2,
meta: {
title: '22222-222'
},
children: [
{
path: '3-2',
components: 3,
meta: {
title: '33333-222'
}
},
{
path: '4-2',
components: 4,
meta: {
title: '4444-2222'
},
}
]
}
]
}"
v-for="route of routes"
:key="route.path"
:route="route"
:basic-route="route.path"
></recursive-list>
</el-menu>
</el-aside>
Expand Down
4 changes: 3 additions & 1 deletion src/router/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const common = [
]

const dynamic = [
'Access'
'Access',
'Access/Admin',
'Access/User'
]

export {
Expand Down
30 changes: 21 additions & 9 deletions src/router/routes/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ import { dynamic } from '../components'
// Service response routes map can be used to expand or rebuild this preset map
export default [
{
path: '/access/admin',
path: '/access',
component: dynamic.access,
meta: {
title: 'Access',
role: ['admin']
}
},
{
path: '/access/user',
component: dynamic.access,
meta: {
role: ['user']
}
},
children: [
{
path: 'admin',
component: dynamic.access,
meta: {
title: 'admin',
role: ['admin']
}
},
{
path: 'user',
component: dynamic.access,
meta: {
title: 'user',
role: ['user']
}
}
]
}
]
6 changes: 3 additions & 3 deletions src/view/Access.vue → src/view/Access/Admin.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<el-main class="permission">
<div class="access__admin">
{{info}}
</el-main>
</div>
</template>

<script>
export default {
data () {
return {
info: 'dynamic routes'
info: 'access__admin'
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/view/Access/User.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div class="access__user">
{{info}}
</div>
</template>

<script>
export default {
data () {
return {
info: 'access__user'
}
}
}
</script>

<style lang="sass" scoped>
</style>
15 changes: 15 additions & 0 deletions src/view/Access/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<el-main class="access">
<router-view></router-view>
</el-main>
</template>

<script>
export default {
}
</script>

<style lang="sass" scoped>
</style>

0 comments on commit c3ba8e1

Please sign in to comment.