File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
frameworks/non-keyed/quel/src Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -49,24 +49,32 @@ const html = `
49
49
50
50
class ViewModel {
51
51
data = [ ] ;
52
- selected = null ;
52
+ selectedIndex ;
53
53
54
54
get "data.*.selected" ( ) {
55
- return this [ "data.*" ] === this . selected ;
55
+ return this . $1 === this . selectedIndex ;
56
+ }
57
+ set "data.*.selected" ( value ) {
58
+ if ( value ) {
59
+ this . selectedIndex = this . $1 ;
60
+ }
56
61
}
57
62
select ( e , $1 ) {
58
- this . selected = this [ "data.*" ] ;
63
+ if ( typeof this . selectedIndex !== "undefined" ) {
64
+ this [ `data.${ this . selectedIndex } .selected` ] = false ;
65
+ }
66
+ this [ `data.${ $1 } .selected` ] = true ;
59
67
}
60
68
remove ( e , $1 ) {
61
69
this . data = this . data . toSpliced ( $1 , 1 ) ;
62
70
}
63
71
run ( ) {
64
72
this . data = buildData ( 1000 ) ;
65
- this . selected = null ;
73
+ this . selectedIndex = undefined ;
66
74
}
67
75
runLots ( ) {
68
76
this . data = buildData ( 10000 ) ;
69
- this . selected = null ;
77
+ this . selectedIndex = undefined ;
70
78
}
71
79
add ( ) {
72
80
this . data = this . data . concat ( buildData ( 1000 ) ) ;
@@ -84,9 +92,6 @@ class ViewModel {
84
92
[ this [ "data.1" ] , this [ "data.998" ] ] = [ this [ "data.998" ] , this [ "data.1" ] ] ;
85
93
}
86
94
}
87
- $dependentProps = {
88
- "data.*.selected" : [ "data.*" , "selected" ]
89
- } ;
90
95
}
91
96
92
97
export default { ViewModel, html } ;
You can’t perform that action at this time.
0 commit comments