File tree Expand file tree Collapse file tree 4 files changed +39
-9
lines changed Expand file tree Collapse file tree 4 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 18
18
| ` bordered ` | Boolean|| bordered style |
19
19
| ` two-line ` | Boolean|| two-line style |
20
20
| ` avatar-list ` | Boolean|| set avatar style list |
21
-
21
+ | ` interactive ` | Boolean || set interactive style for hover, focus, and press states |
22
22
23
23
### Dense List
24
24
Original file line number Diff line number Diff line change 22
22
</mdc-layout-cell >
23
23
24
24
<mdc-layout-cell >
25
- <mdc-list dense bordered >
25
+ <mdc-list dense bordered >
26
26
<mdc-list-item >
27
27
<i slot =" start-detail" class =" material-icons" >favorite_border</i >
28
28
start details
Original file line number Diff line number Diff line change 1
1
<template >
2
- <li class =" mdc-list-item" >
2
+ <li class =" mdc-list-item"
3
+ :class =" classes" :style =" styles"
4
+ :tabindex =" isInteractive ? '0' : undefined" >
3
5
4
6
<span class =" mdc-list-item__graphic" v-if =" hasStartDetail" >
5
7
<slot name =" start-detail" ></slot >
21
23
</template >
22
24
23
25
<script >
26
+ import {RippleBase } from ' ../ripple'
27
+
24
28
export default {
25
29
name: ' mdc-list-item' ,
30
+ inject: [' mdcList' ],
31
+ data () {
32
+ return {
33
+ classes: {},
34
+ styles: {}
35
+ }
36
+ },
26
37
computed: {
38
+ isInteractive () {
39
+ return this .mdcList && this .mdcList .interactive
40
+ },
27
41
hasSecondary () {
28
42
return !! this .$slots [' secondary' ]
29
43
},
@@ -33,6 +47,17 @@ export default {
33
47
hasStartDetail () {
34
48
return !! this .$slots [' start-detail' ]
35
49
}
50
+ },
51
+ mounted () {
52
+ if (this .isInteractive ) {
53
+ this .ripple = new RippleBase (this )
54
+ this .ripple .init ()
55
+ }
56
+ },
57
+ beforeDestroy () {
58
+ this .ripple && this .ripple .destroy ()
59
+ this .ripple = null
36
60
}
37
61
}
38
62
</script >
63
+
Original file line number Diff line number Diff line change 8
8
export default {
9
9
name: ' mdc-list' ,
10
10
props: {
11
- ' dense' : Boolean ,
12
- ' avatar-list' : Boolean ,
13
- ' two-line' : Boolean ,
14
- ' bordered' : Boolean
11
+ dense: Boolean ,
12
+ avatarList: Boolean ,
13
+ twoLine: Boolean ,
14
+ bordered: Boolean ,
15
+ interactive: Boolean
16
+ },
17
+ provide () {
18
+ return { mdcList: this }
15
19
},
16
20
data () {
17
21
return {
18
22
classes: {
19
23
' mdc-list--dense' : this .dense ,
20
24
' mdc-list--avatar-list' : this .avatarList ,
21
25
' mdc-list--two-line' : this .twoLine ,
22
- ' mdc-list--bordered' : this .bordered
23
- }
26
+ ' mdc-list--bordered' : this .bordered ,
27
+ ' mdc-list--non-interactive' : ! this .interactive
28
+ }
24
29
}
25
30
}
26
31
}
You can’t perform that action at this time.
0 commit comments