File tree Expand file tree Collapse file tree 2 files changed +34
-10
lines changed Expand file tree Collapse file tree 2 files changed +34
-10
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ export default {
39
39
return this .mdcList && this .mdcList .interactive
40
40
},
41
41
hasSecondary () {
42
- return !! this .$slots [' secondary' ]
42
+ return this .$slots [' secondary' ] && (
43
+ this .mdcList && this .mdcList .twoLine
44
+ )
43
45
},
44
46
hasEndDetail () {
45
47
return !! this .$slots [' end-detail' ]
@@ -48,16 +50,38 @@ export default {
48
50
return !! this .$slots [' start-detail' ]
49
51
}
50
52
},
51
- mounted () {
52
- if (this .isInteractive ) {
53
- this .ripple = new RippleBase (this )
54
- this .ripple .init ()
53
+ watch: {
54
+ isInteractive (value ) {
55
+ if (value) {
56
+ this .addRipple ()
57
+ } else {
58
+ this .removeRipple ()
59
+ }
55
60
}
56
61
},
62
+ mounted () {
63
+ this .isInteractive && this .addRipple ()
64
+ },
57
65
beforeDestroy () {
58
- this .ripple && this .ripple .destroy ()
59
- this .ripple = null
66
+ this .removeRipple ()
67
+ },
68
+ methods: {
69
+ addRipple () {
70
+ if (! this .ripple ) {
71
+ let ripple = new RippleBase (this )
72
+ ripple .init ()
73
+ this .ripple = ripple
74
+ }
75
+ },
76
+ removeRipple () {
77
+ if (this .ripple ) {
78
+ let ripple = this .ripple
79
+ this .ripple = null
80
+ ripple .destroy ()
81
+ }
82
+ }
60
83
}
84
+
61
85
}
62
86
</script >
63
87
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ export default {
17
17
provide () {
18
18
return { mdcList: this }
19
19
},
20
- data () {
21
- return {
22
- classes : {
20
+ computed : {
21
+ classes () {
22
+ return {
23
23
' mdc-list--dense' : this .dense ,
24
24
' mdc-list--avatar-list' : this .avatarList ,
25
25
' mdc-list--two-line' : this .twoLine ,
You can’t perform that action at this time.
0 commit comments