# admin传统布局
# 示例
<template>
<lx-layout :left-nav-style="{ width: menuCollapse ? 'auto' : '210px' }"
:show-header="true"
>
<template v-slot:header>
<div>header content</div>
</template>
<template v-slot:leftNav>
<lx-menu
:auto-jump="false"
:data="menuData"
:default-active="defaultActive"
height="100%"
:node-props="{
index: 'meta.menuId',
children: 'children',
path: 'path',
hidden: 'meta.hidden',
title: 'meta.title'
}"
@click="selectNav"
>
</lx-menu>
</template>
<template v-slot:content>
<div class="content-wrap">
<div class="page-wrap">
<router-view></router-view>
</div>
</div>
</template>
</lx-layout>
</template>
<script>
export default {
data () {
return {
collapse: false,
menuData: [
{
path: '/home',
icon: 'el-icon-s-home',
meta: {
enable: true,
hidden: false,
isMenu: 1,
title: '首页',
menuId: '1',
icon: 'el-icon-edit'
}
},
{
icon: 'el-icon-s-home',
meta: {
enable: true,
hidden: false,
isMenu: 1,
title: '组件库',
menuId: '7',
icon: 'el-icon-edit'
},
children: [
{
path: '/dynamic-form',
icon: 'el-icon-s-home',
meta: {
enable: true,
hidden: false,
isMenu: 1,
title: '动态表单',
menuId: '7-1'
}
},
{
path: '/dynamic-table',
icon: 'el-icon-s-home',
meta: {
enable: true,
hidden: false,
isMenu: 1,
title: '动态表格',
menuId: '7-2'
}
}
]
}
],
defaultActive: '7-1'
}
},
methods: {
selectNav (navItem) {
console.log('navItem', navItem)
}
}
}
</script>
<style>
.content-wrap {
background: #d8d8d8;
width: 100%;
height: 300px;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Expand Copy Copy
← filter-table 卡片card →