Skip to content

Commit e7148c1

Browse files
committed
新增 字段集区块
1 parent f29a6ee commit e7148c1

5 files changed

Lines changed: 101 additions & 13 deletions

File tree

‎src/App.vue‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
</layui-col>
1111
</layui-row>
1212
</layui-container>
13-
<layui-hr color="red" title="标题"></layui-hr>
1413
<layui-hr color="orange"></layui-hr>
1514
<layui-hr color="green"></layui-hr>
1615
<layui-hr color="cyan"></layui-hr>
@@ -74,6 +73,10 @@
7473
<layui-btn type="reset" item="primary">重置</layui-btn>
7574
</layui-form-item>
7675
</layui-form>
76+
77+
<layui-block color="red">引用区域的文字1</layui-block>
78+
<layui-block color="red" title="标题">引用区域的文字2</layui-block>
79+
<layui-block color="red" title="标题" border>引用区域的文字3</layui-block>
7780
</div>
7881
</template>
7982

‎src/components/auxiliary/block.vue‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<div style="margin: 10px">
3+
<blockquote v-if="!title" class="layui-elem-quote" :style="'border-left: 5px solid ' + color">
4+
<slot></slot>
5+
</blockquote>
6+
<fieldset v-if="title"
7+
class="layui-elem-field"
8+
:class="border ? '' : 'layui-field-title'"
9+
:style="styleName">
10+
<legend>{{title}}</legend>
11+
<div class="layui-field-box">
12+
<slot></slot>
13+
</div>
14+
</fieldset>
15+
</div>
16+
17+
</template>
18+
19+
<script>
20+
export default {
21+
name: 'layui-block',
22+
props: {
23+
color: String,
24+
title: String,
25+
border: Boolean
26+
},
27+
data: function () {
28+
return {
29+
styleName: {
30+
'border-color': this.color
31+
}
32+
}
33+
}
34+
}
35+
</script>
36+
37+
<style scoped>
38+
39+
</style>

‎src/components/auxiliary/hr.vue‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<template>
22
<div>
3-
<hr v-if="!title" :class="className">
4-
5-
<fieldset v-if="title" class="layui-elem-field layui-field-title" :style="styleName">
6-
<legend>{{title}}</legend>
7-
</fieldset>
3+
<hr :class="className">
84
</div>
95

106
</template>
@@ -13,15 +9,11 @@
139
export default {
1410
name: 'layui-hr',
1511
props: {
16-
color: String,
17-
title: String
12+
color: String
1813
},
1914
data: function () {
2015
return {
21-
className: 'layui-bg-' + this.color,
22-
styleName: {
23-
'border-color': this.color
24-
}
16+
className: 'layui-bg-' + this.color
2517
}
2618
}
2719
}

‎src/components/tabs/tab.vue‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<div class="layui-tab">
3+
<ul class="layui-tab-title">
4+
<li class="layui-this">权限分配</li>
5+
</ul>
6+
<ul class="layui-tab-title">
7+
<li>网站设置</li>
8+
</ul>
9+
<ul class="layui-tab-title">
10+
<li>网站设置</li>
11+
</ul>
12+
<div class="layui-tab-content">
13+
<div class="layui-tab-item layui-show">内容1</div>
14+
<div class="layui-tab-item">内容2</div>
15+
<div class="layui-tab-item">内容3</div>
16+
<div class="layui-tab-item">内容4</div>
17+
<div class="layui-tab-item">内容5</div>
18+
</div>
19+
</div>
20+
21+
</template>
22+
23+
<script>
24+
export default {
25+
name: 'layui-tab',
26+
props: {
27+
item: {
28+
item: String,
29+
default: 'default'
30+
},
31+
size: String,
32+
radius: Boolean,
33+
icon: String,
34+
right: Boolean,
35+
type: String
36+
}
37+
}
38+
</script>
39+
40+
<style scoped>
41+
i.right{
42+
padding-left: 4px;
43+
}
44+
45+
i.left{
46+
padding-right: 4px;
47+
}
48+
49+
</style>

‎src/index.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import checkbox from './components/form/checkbox'
1818
import select from './components/form/select'
1919
import textarea from './components/form/textarea'
2020

21+
import tab from './components/tabs/tab'
22+
2123
import hr from './components/auxiliary/hr'
24+
import block from './components/auxiliary/block'
2225

2326
const layui = {
2427
config: {},
@@ -39,7 +42,9 @@ const layui = {
3942
checkbox,
4043
select,
4144
textarea,
42-
hr
45+
tab,
46+
hr,
47+
block
4348
]
4449
components.forEach(function (component) {
4550
Vue.component(component.name, component)

0 commit comments

Comments
 (0)