File tree 11 files changed +451
-36
lines changed
11 files changed +451
-36
lines changed Original file line number Diff line number Diff line change 65
65
<span >基本元素</span >
66
66
</template >
67
67
<lay-menu-child-item title =" 按钮" :to =" {name: 'button'}" ></lay-menu-child-item >
68
- <lay-menu-child-item title =" 表单" :to =" {name: 'form'}" ></lay-menu-child-item >
68
+ <lay-menu-child-item title =" 表单" :to =" {name: 'form'}" ></lay-menu-child-item >
69
+ <lay-menu-child-item title =" 导航/面包屑" :to =" {name: 'nav'}" ></lay-menu-child-item >
69
70
70
71
</lay-menu-item >
71
72
</lay-menu >
Original file line number Diff line number Diff line change
1
+ /**
2
+ * kouchao 创建于 2018/8/27
3
+ */
4
+
5
+ import LayBadge from './src/badge' ;
6
+
7
+ /* istanbul ignore next */
8
+ LayBadge . install = function ( Vue ) {
9
+ Vue . component ( LayBadge . name , LayBadge ) ;
10
+ } ;
11
+
12
+ export default LayBadge ;
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <span :class =" classList" :style =" styleList" >
3
+ <slot v-if =" type != 'dot'" ></slot >
4
+ </span >
5
+ </template >
6
+ <script >
7
+ export default {
8
+ name: ' LayBadge' ,
9
+ props: {
10
+ type: String ,
11
+ theme: String ,
12
+ color: String
13
+ },
14
+ data (){
15
+ return {
16
+ classList: [{
17
+ ' layui-badge' : ! this .type ,
18
+ ' layui-badge-dot' : this .type == ' dot' ,
19
+ ' layui-badge-rim' : this .type == ' rim' ,
20
+ },
21
+ ' layui-bg-' + this .theme ],
22
+ styleList: this .color ? ' background-color: ' + this .color : ' '
23
+ }
24
+ }
25
+ }
26
+ </script >
Original file line number Diff line number Diff line change
1
+ /**
2
+ * kouchao 创建于 2018/8/27
3
+ */
4
+
5
+ import LayBreadcrumbItem from '../breadcrumb/src/breadcrumb-item' ;
6
+
7
+ /* istanbul ignore next */
8
+ LayBreadcrumbItem . install = function ( Vue ) {
9
+ Vue . component ( LayBreadcrumbItem . name , LayBreadcrumbItem ) ;
10
+ } ;
11
+
12
+ export default LayBreadcrumbItem ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * kouchao 创建于 2018/8/27
3
+ */
4
+
5
+ import LayBreadcrumb from './src/breadcrumb' ;
6
+
7
+ /* istanbul ignore next */
8
+ LayBreadcrumb . install = function ( Vue ) {
9
+ Vue . component ( LayBreadcrumb . name , LayBreadcrumb ) ;
10
+ } ;
11
+
12
+ export default LayBreadcrumb ;
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <span class =" layui-breadcrumb-item" >
3
+ <a href =" javascript:void(0);" @click =" handleClick" >
4
+ <slot ></slot >
5
+ </a >
6
+ <span lay-separator =" " class =" separator" >{{layBreadcrumb.separator}}</span >
7
+ </span >
8
+
9
+ </template >
10
+ <script >
11
+ export default {
12
+ name: ' LayBreadcrumbItem' ,
13
+ inject: [' layBreadcrumb' ],
14
+ props: {
15
+ to: Object
16
+ },
17
+ methods: {
18
+ handleClick () {
19
+ if (this .$route && this .to ){
20
+ this .$router .push (this .to )
21
+ }
22
+ }
23
+ }
24
+ }
25
+ </script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <span class =" layui-breadcrumb" style =" visibility : visible ;" >
3
+ <slot ></slot >
4
+ </span >
5
+ </template >
6
+ <script >
7
+ export default {
8
+ name: ' LayBreadcrumb' ,
9
+ props: {
10
+ separator: {
11
+ type: String ,
12
+ default (){
13
+ return ' /'
14
+ }
15
+ }
16
+ },
17
+ provide () {
18
+ return {
19
+ layBreadcrumb: this
20
+ };
21
+ },
22
+ mounted () {
23
+ const items = this .$el .querySelectorAll (' .layui-breadcrumb-item .separator' );
24
+ if (items .length ) {
25
+ items[items .length - 1 ].style .display = ' none'
26
+ }
27
+ }
28
+ }
29
+ </script >
30
+
31
+ <style scoped>
32
+
33
+ </style >
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<ul class =" layui-nav"
3
- :class =" {
4
- 'layui-nav-tree': this.mode == 'vertical'
5
- }" >
3
+ :class =" classList"
4
+ :style =" styleList" >
6
5
<slot ></slot >
7
6
</ul >
8
7
</template >
12
11
13
12
export default {
14
13
name: " LayMenu" ,
15
- data () {
16
- return {
17
- openeds: this .defaultOpeneds
18
- }
19
- },
20
- props: {
14
+ data () {
15
+ return {
16
+ openeds: this .defaultOpeneds ,
17
+ classList: [{
18
+ ' layui-nav-tree' : this .mode == ' vertical'
19
+ },
20
+ ' layui-bg-' + this .theme
21
+ ],
22
+ styleList: this .color ? ' background-color: ' + this .color : ' '
23
+ }
24
+ },
25
+ props: {
21
26
// horizontal / vertical
22
- mode: {
23
- type: String ,
24
- default: ' vertical' ,
25
- },
26
- defaultOpeneds: {
27
- type: Array ,
28
- default () {
29
- return []
30
- },
31
- },
32
- uniqueOpened: {
33
- type: Boolean ,
34
- default: false
35
- }
36
- },
27
+ mode: {
28
+ type: String ,
29
+ default: ' vertical' ,
30
+ },
31
+ defaultOpeneds: {
32
+ type: Array ,
33
+ default () {
34
+ return []
35
+ },
36
+ },
37
+ uniqueOpened: {
38
+ type: Boolean ,
39
+ default: false
40
+ },
41
+ theme: String ,
42
+ color: String
43
+ },
37
44
mixins: [eventHub],
38
45
provide () {
39
46
return {
40
47
rootMenu: this
41
48
};
42
49
},
43
50
methods: {
44
- handleItemClick (item ) {
45
- const {index } = item
46
- const activeIndex = this .openeds .findIndex (o => o == index)
47
- if (activeIndex == - 1 ){
48
- this .uniqueOpened ? this .openeds = [index] : this .openeds .push (index)
49
- } else {
50
- this .openeds .splice (activeIndex, 1 )
51
- }
51
+ handleItemClick (item ) {
52
+ const {index } = item
53
+ const activeIndex = this .openeds .findIndex (o => o == index)
54
+ if (activeIndex == - 1 ) {
55
+ this .uniqueOpened ? this .openeds = [index] : this .openeds .push (index)
56
+ } else {
57
+ this .openeds .splice (activeIndex, 1 )
58
+ }
52
59
53
- }
54
- },
60
+ }
61
+ },
55
62
mounted () {
56
63
this .eventOn (' menu-item-click' , this .handleItemClick );
57
64
}
Original file line number Diff line number Diff line change 2
2
* kouchao 创建于 2018/8/27
3
3
*/
4
4
5
-
6
5
import LayRow from '@/components/row'
7
6
import LayCol from '@/components/col'
8
7
import LayContainer from '@/components/container'
@@ -34,6 +33,9 @@ import LaySide from '@/components/side'
34
33
import LayBody from '@/components/body'
35
34
import LayFooter from '@/components/footer'
36
35
import LayBlock from '@/components/block'
36
+ import LayBadge from '@/components/badge'
37
+ import LayBreadcrumb from '@/components/breadcrumb'
38
+ import LayBreadcrumbItem from '@/components/breadcrumb-item'
37
39
38
40
39
41
@@ -71,6 +73,9 @@ const layui = {
71
73
LayBody ,
72
74
LayFooter ,
73
75
LayBlock ,
76
+ LayBadge ,
77
+ LayBreadcrumb ,
78
+ LayBreadcrumbItem ,
74
79
]
75
80
components . forEach ( function ( component ) {
76
81
Vue . component ( component . name , component )
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import About from './views/About.vue'
5
5
import Grid from './views/Grid.vue'
6
6
import Button from './views/Button.vue'
7
7
import Form from './views/Form.vue'
8
+ import Nav from './views/Nav.vue'
8
9
9
10
Vue . use ( Router )
10
11
@@ -34,8 +35,15 @@ export default new Router({
34
35
path : '/form' ,
35
36
name : 'form' ,
36
37
component : Form
38
+ } ,
39
+ {
40
+ path : '/nav' ,
41
+ name : 'nav' ,
42
+ component : Nav
37
43
}
38
44
39
45
46
+
47
+
40
48
]
41
49
} )
You can’t perform that action at this time.
0 commit comments