Skip to content

Commit 254ce8d

Browse files
committed
组件
1 parent 807f141 commit 254ce8d

File tree

12 files changed

+169
-31
lines changed

12 files changed

+169
-31
lines changed

src/layout/Layout.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<sidebar></sidebar>
1212
<!-- 右侧视图 -->
1313
<div class="view">
14-
<router-view></router-view>
14+
<div class="conatiner">
15+
<router-view></router-view>
16+
</div>
1517
</div>
1618
</div>
1719
</div>
@@ -45,7 +47,7 @@ export default {
4547
.view {
4648
width: auto;
4749
height: 100%;
48-
padding: 2rem;
50+
padding: 1rem;
4951
position: absolute;
5052
left: 240px;
5153
right: 0;
@@ -54,6 +56,12 @@ export default {
5456
padding-bottom: 30px;
5557
transition: left 0.3s ease-in-out;
5658
background: #f0f0f0;
59+
.conatiner {
60+
background: #fff;
61+
width: inherit;
62+
height: inherit;
63+
padding: 1rem;
64+
}
5765
}
5866
}
5967
.sidebar-close {

src/router/constant-routes.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/********************************定义一个方法将modules中的文件全部导入进来 start********************************/
2+
const routerList = [];
3+
function importAll (r) {
4+
r.keys().forEach((key) => routerList.push(r(key).default));
5+
}
6+
importAll(require.context('./modules', true, /\.js/));
7+
/********************************定义一个方法将modules中的文件全部导入进来 end********************************/
8+
9+
// 用户定义的全部路由
10+
export const constantRoutes = routerList;

src/router/modules/form.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default {
2+
name: 'form',
3+
path: '/form',
4+
meta: { title: '表单组件' },
5+
component: () => import('@/views/pages/form/Index.vue'),
6+
redirect: '/base_form',
7+
children: [
8+
{
9+
name: 'base_form',
10+
path: '/base_form',
11+
meta: { title: '基础表单' },
12+
component: () => import('@/views/pages/form/base-form/Index.vue'),
13+
},
14+
{
15+
name: 'upload',
16+
path: '/upload',
17+
meta: { title: '上传组件' },
18+
component: () => import('@/views/pages/form/upload/Index.vue'),
19+
},
20+
],
21+
};

src/router/modules/tab.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
name: 'tab',
3+
path: '/tab',
4+
meta: { title: '选项卡' },
5+
component: () => import('@/views/pages/tab/Index.vue'),
6+
};

src/router/modules/table.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
name: 'table',
3+
path: '/table',
4+
meta: { title: '表格组件' },
5+
component: () => import('@/views/pages/table/Index.vue'),
6+
};

src/router/router.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import VueRouter from 'vue-router'
33
import home from './shared/home';
44
import login from './shared/login';
55
import { setTitle } from '@/utils';
6-
6+
import { constantRoutes } from './constant-routes';
77
Vue.use(VueRouter)
88

99
const routes = [
@@ -15,6 +15,7 @@ const routes = [
1515
redirect: '/home',
1616
children: [
1717
...home,
18+
...constantRoutes,
1819
],
1920
},
2021
...login,

src/store/modules/view.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,32 @@ const state = {
33
sidebarOpened: true,
44
title: '主页',
55
menuList: [
6-
{
7-
icon: 'el-icon-s-home',
8-
index: 'dashboard',
9-
title: '系统首页'
10-
},
116
{
127
icon: 'el-icon-s-order',
138
index: 'table',
149
title: '基础表格'
1510
},
1611
{
1712
icon: 'el-icon-s-marketing',
18-
index: 'tabs',
13+
index: 'tab',
1914
title: 'tab选项卡'
2015
},
2116
{
2217
icon: 'el-icon-folder-opened',
23-
index: '3',
18+
index: 'form',
2419
title: '表单相关',
2520
children: [
2621
{
27-
index: 'form',
22+
index: 'base_form',
2823
title: '基本表单',
2924
icon: 'el-icon-s-data',
3025
},
31-
{
32-
index: '3-2',
33-
title: '三级菜单',
34-
children: [
35-
{
36-
index: 'editor',
37-
title: '富文本编辑器'
38-
},
39-
{
40-
index: 'markdown',
41-
title: 'markdown编辑器'
42-
}
43-
]
44-
},
4526
{
4627
index: 'upload',
4728
title: '文件上传'
4829
}
4930
]
50-
},
51-
{
52-
icon: 'el-icon-s-marketing',
53-
index: 'tabs1',
54-
title: 'tab1选项卡'
55-
},
31+
}
5632
],
5733
};
5834

src/views/pages/form/Index.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<router-view />
3+
</template>
4+
5+
<script>
6+
export default {
7+
8+
}
9+
</script>
10+
11+
<style lang="scss" scoped>
12+
</style>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div>
3+
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
10+
}
11+
</script>
12+
13+
<style lang="scss" scoped>
14+
</style>

src/views/pages/form/upload/Index.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div>
3+
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
10+
}
11+
</script>
12+
13+
<style lang="scss" scoped>
14+
</style>

0 commit comments

Comments
 (0)