File tree Expand file tree Collapse file tree 1 file changed +23
-28
lines changed
platform/nativescript/runtime/components Expand file tree Collapse file tree 1 file changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ export default {
7
7
type : Array ,
8
8
required : true
9
9
} ,
10
- separatorColor : {
11
- type : String
12
- } ,
13
10
'+alias' : {
14
11
type : String ,
15
12
default : 'item'
@@ -19,20 +16,18 @@ export default {
19
16
}
20
17
} ,
21
18
22
- render ( h ) {
23
- return h (
24
- 'native-list-view' ,
25
- {
26
- ref : 'listView' ,
27
- on : this . _on ,
28
- domProps : {
29
- items : this . items ,
30
- separatorColor : this . separatorColor
31
- }
32
- } ,
33
- this . $slots . default
34
- )
35
- } ,
19
+ template : `
20
+ <native-list-view
21
+ ref="listView"
22
+ :items="items"
23
+ v-bind="$attrs"
24
+ v-on="listeners"
25
+ @itemTap="onItemTap"
26
+ @itemLoading="onItemLoading"
27
+ >
28
+ <slot />
29
+ </native-list-view>
30
+ ` ,
36
31
37
32
watch : {
38
33
items : {
@@ -45,17 +40,11 @@ export default {
45
40
} ,
46
41
47
42
created ( ) {
48
- this . _on = {
49
- itemLoading : this . onItemLoading ,
50
- itemTap : args =>
51
- this . $emit (
52
- 'itemTap' ,
53
- Object . assign ( { item : this . items [ args . index ] } , args )
54
- ) ,
55
- loaded : args => this . $emit ( 'loaded' , args ) ,
56
- unloaded : args => this . $emit ( 'unloaded' , args ) ,
57
- loadMoreItems : args => this . $emit ( 'loadMoreItems' , args )
58
- }
43
+ // we need to remove the itemTap handler from a clone of the $listeners
44
+ // object because we are emitting the event ourselves with added data.
45
+ const listeners = Object . assign ( { } , this . $listeners )
46
+ delete listeners . itemTap
47
+ this . listeners = listeners
59
48
} ,
60
49
61
50
mounted ( ) {
@@ -73,6 +62,12 @@ export default {
73
62
} ,
74
63
75
64
methods : {
65
+ onItemTap ( args ) {
66
+ this . $emit (
67
+ 'itemTap' ,
68
+ Object . assign ( { item : this . items [ args . index ] } , args )
69
+ )
70
+ } ,
76
71
onItemLoading ( args ) {
77
72
const index = args . index
78
73
const items = args . object . items
You can’t perform that action at this time.
0 commit comments