Skip to content

Commit 52b5760

Browse files
committed
新增 布局相关
1 parent 017517d commit 52b5760

16 files changed

Lines changed: 229 additions & 75 deletions

File tree

‎src/App.vue‎

Lines changed: 75 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,81 @@
11
<template>
22
<div id="app">
3-
<div id="nav">
4-
<router-link to="/">Home</router-link> |
5-
<router-link to="/about">About</router-link>
6-
</div>
7-
<router-view/>
3+
4+
<lay-admin>
5+
<lay-header>
6+
<lay-logo>vue-layui</lay-logo>
7+
<lay-menu mode="horizontal" class="layui-layout-left">
8+
<LayMenuItem :index="0">
9+
<template slot="title">
10+
<span>导航一</span>
11+
</template>
12+
<LayMenuChildItem title="test"></LayMenuChildItem>
13+
<LayMenuChildItem title="test"></LayMenuChildItem>
14+
</LayMenuItem>
15+
<LayMenuItem :index="1">
16+
<template slot="title">
17+
<span>导航一</span>
18+
</template>
19+
</LayMenuItem>
20+
<LayMenuItem :index="2">
21+
<template slot="title">
22+
<span>导航一</span>
23+
</template>
24+
</LayMenuItem>
25+
<LayMenuItem :index="3">
26+
<template slot="title">
27+
<span>导航一</span>
28+
</template>
29+
</LayMenuItem>
30+
</lay-menu>
31+
<lay-menu mode="horizontal" class="layui-layout-right">
32+
<LayMenuItem :index="0">
33+
<template slot="title">
34+
<img src="https://avatars1.githubusercontent.com/u/23720738?s=460&v=4" class="layui-nav-img"> admin
35+
</template>
36+
<LayMenuChildItem title="基本资料"></LayMenuChildItem>
37+
<LayMenuChildItem title="安全设置"></LayMenuChildItem>
38+
</LayMenuItem>
39+
<LayMenuItem :index="0">
40+
<template slot="title">
41+
退出
42+
</template>
43+
</LayMenuItem>
44+
</lay-menu>
45+
</lay-header>
46+
<lay-side>
47+
<lay-menu :default-openeds="[0]">
48+
<LayMenuItem :index="0">
49+
<template slot="title">
50+
<span>导航一</span>
51+
</template>
52+
<LayMenuChildItem title="home" :to="{name: 'home'}"></LayMenuChildItem>
53+
<LayMenuChildItem title="about" :to="{name: 'about'}"></LayMenuChildItem>
54+
</LayMenuItem>
55+
<LayMenuItem :index="1">
56+
<template slot="title">
57+
<span>导航二</span>
58+
</template>
59+
<LayMenuChildItem title="test"></LayMenuChildItem>
60+
<LayMenuChildItem title="test"></LayMenuChildItem>
61+
<LayMenuChildItem title="test"></LayMenuChildItem>
62+
<LayMenuChildItem title="test"></LayMenuChildItem>
63+
</LayMenuItem>
64+
</lay-menu>
65+
</lay-side>
66+
<lay-body>
67+
<router-view/>
68+
</lay-body>
69+
<lay-footer>
70+
this is footer
71+
</lay-footer>
72+
73+
</lay-admin>
74+
75+
876
</div>
977
</template>
1078

11-
<style lang="scss">
12-
#app {
13-
font-family: 'Avenir', Helvetica, Arial, sans-serif;
14-
-webkit-font-smoothing: antialiased;
15-
-moz-osx-font-smoothing: grayscale;
16-
color: #2c3e50;
17-
}
18-
#nav {
19-
padding: 30px;
20-
a {
21-
font-weight: bold;
22-
color: #2c3e50;
23-
&.router-link-exact-active {
24-
color: #42b983;
25-
}
26-
}
27-
}
79+
<style>
80+
2881
</style>

‎src/components/body/index.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* kouchao 创建于 2018/8/27
3+
*/
4+
5+
import LayBody from './src/body';
6+
7+
/* istanbul ignore next */
8+
LayBody.install = function(Vue) {
9+
Vue.component(LayBody.name, LayBody);
10+
};
11+
12+
export default LayBody;

‎src/components/body/src/body.vue‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<div class="layui-body">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
name: 'LayBody'
9+
}
10+
</script>

‎src/components/footer/index.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* kouchao 创建于 2018/8/27
3+
*/
4+
5+
import LayFooter from './src/footer';
6+
7+
/* istanbul ignore next */
8+
LayFooter.install = function(Vue) {
9+
Vue.component(LayFooter.name, LayFooter);
10+
};
11+
12+
export default LayFooter;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<div class="layui-footer">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
name: 'LayFooter'
9+
}
10+
</script>

‎src/components/header/index.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* kouchao 创建于 2018/8/27
3+
*/
4+
5+
import LayHeader from './src/header';
6+
7+
/* istanbul ignore next */
8+
LayHeader.install = function(Vue) {
9+
Vue.component(LayHeader.name, LayHeader);
10+
};
11+
12+
export default LayHeader;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<div class="layui-header">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
name: 'LayHeader'
9+
}
10+
</script>

‎src/components/logo/index.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* kouchao 创建于 2018/8/27
3+
*/
4+
5+
import LayLogo from './src/logo';
6+
7+
/* istanbul ignore next */
8+
LayLogo.install = function(Vue) {
9+
Vue.component(LayLogo.name, LayLogo);
10+
};
11+
12+
export default LayLogo;

‎src/components/logo/src/logo.vue‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<div class="layui-logo">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
name: 'LayLogo'
9+
}
10+
</script>

‎src/components/menu/src/menu-child-item.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<dd><a href="javascript:;" @click="handleClick">列表一</a></dd>
2+
<dd><a href="javascript:;" @click="handleClick">{{title}}</a></dd>
33
</template>
44

55
<script>
@@ -19,7 +19,7 @@
1919
methods: {
2020
handleClick() {
2121
if(this.$route && this.to){
22-
this.$route.push(this.to)
22+
this.$router.push(this.to)
2323
}
2424
}
2525
}

0 commit comments

Comments
 (0)