Skip to content

Commit 878ba95

Browse files
committed
更新 布局相关组件和文档,修复 布局的一些bug
1 parent 52b5760 commit 878ba95

File tree

16 files changed

+436
-97
lines changed

16 files changed

+436
-97
lines changed

src/App.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
<lay-menu :default-openeds="[0]">
4848
<LayMenuItem :index="0">
4949
<template slot="title">
50-
<span>导航一</span>
50+
<span>布局</span>
5151
</template>
52+
<LayMenuChildItem title="栅格" :to="{name: 'grid'}"></LayMenuChildItem>
53+
<LayMenuChildItem title="后台布局"></LayMenuChildItem>
5254
<LayMenuChildItem title="home" :to="{name: 'home'}"></LayMenuChildItem>
5355
<LayMenuChildItem title="about" :to="{name: 'about'}"></LayMenuChildItem>
5456
</LayMenuItem>

src/components/block/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 LayBlock from './src/block';
6+
7+
/* istanbul ignore next */
8+
LayBlock.install = function(Vue) {
9+
Vue.component(LayBlock.name, LayBlock);
10+
};
11+
12+
export default LayBlock;
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
22
<div style="margin: 10px">
3-
<blockquote v-if="!title" class="layui-elem-quote" :style="'border-left: 5px solid ' + color">
3+
<blockquote v-if="!title" class="layui-elem-quote" :style="styleName">
44
<slot></slot>
55
</blockquote>
66
<fieldset v-if="title"
77
class="layui-elem-field"
88
:class="border ? '' : 'layui-field-title'"
99
:style="styleName">
1010
<legend>{{title}}</legend>
11-
<div class="layui-field-box">
11+
<div class="layui-field-box" v-if="$slots.default">
1212
<slot></slot>
1313
</div>
1414
</fieldset>
@@ -18,7 +18,7 @@
1818

1919
<script>
2020
export default {
21-
name: 'layui-block',
21+
name: 'LayBlock',
2222
props: {
2323
color: String,
2424
title: String,
@@ -35,5 +35,8 @@
3535
</script>
3636

3737
<style scoped>
38+
.layui-elem-quote {
39+
border-left: 5px solid #009688
40+
}
3841
3942
</style>

src/components/col/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 LayCol from './src/col';
6+
7+
/* istanbul ignore next */
8+
LayCol.install = function(Vue) {
9+
Vue.component(LayCol.name, LayCol);
10+
};
11+
12+
export default LayCol;

src/components/col/src/col.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<div :class="classList">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'LayCol',
10+
props: {
11+
xs: Number,
12+
sm: Number,
13+
md: Number,
14+
lg: Number,
15+
xl: Number,
16+
offset: Number
17+
},
18+
data: function () {
19+
return {
20+
classList: ''
21+
}
22+
},
23+
mounted: function () {
24+
['xs', 'sm', 'md', 'lg', 'xl'].forEach(size => {
25+
if (this[size] && this[size] <= 12) {
26+
if (this.offset) {
27+
this.classList += `layui-col-${size + this[size]} `
28+
this.classList += `layui-col-${size + '-offset' + this.offset} `
29+
} else {
30+
this.classList += `layui-col-${size + this[size]} `
31+
}
32+
}
33+
})
34+
}
35+
}
36+
</script>
37+
38+
<style>
39+
40+
</style>

src/components/container/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 LayContainer from './src/container';
6+
7+
/* istanbul ignore next */
8+
LayContainer.install = function(Vue) {
9+
Vue.component(LayContainer.name, LayContainer);
10+
};
11+
12+
export default LayContainer;

src/components/layout/container.vue renamed to src/components/container/src/container.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script>
88
export default {
9-
name: 'layui-container',
9+
name: 'LayContainer',
1010
props: {
1111
fluid: Boolean
1212
},

src/components/layout/col.vue

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/components/row/index.js

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

77
<script>
88
export default {
9-
name: 'layui-row',
9+
name: 'LayRow',
1010
props: {
1111
space: Number
1212
},

0 commit comments

Comments
 (0)