Skip to content

Commit 3c953d8

Browse files
committed
新增 带标题的分割线
1 parent c25a0b0 commit 3c953d8

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎src/App.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</layui-col>
1111
</layui-row>
1212
</layui-container>
13-
<layui-hr color="red"></layui-hr>
13+
<layui-hr color="red" title="标题"></layui-hr>
1414
<layui-hr color="orange"></layui-hr>
1515
<layui-hr color="green"></layui-hr>
1616
<layui-hr color="cyan"></layui-hr>

‎src/components/auxiliary/hr.vue‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
<template>
2-
<hr :class="className">
2+
<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>
8+
</div>
9+
310
</template>
411

512
<script>
613
export default {
714
name: 'layui-hr',
815
props: {
9-
color: String
16+
color: String,
17+
title: String
1018
},
1119
data: function () {
1220
return {
13-
className: 'layui-bg-' + this.color
21+
className: 'layui-bg-' + this.color,
22+
styleName: {
23+
'border-color': this.color
24+
}
1425
}
1526
}
1627
}

0 commit comments

Comments
 (0)