File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 67
67
},
68
68
},
69
69
props: {
70
- distance: Number ,
70
+ distance: {
71
+ type: Number ,
72
+ default: 100 ,
73
+ },
71
74
onInfinite: Function ,
72
75
spinner: String ,
73
76
},
74
- ready () {
75
- if (this .distance === undefined ) {
76
- this .$set (' distance' , 100 );
77
- }
78
-
77
+ mounted () {
79
78
this .scrollParent = getScrollParent (this .$el );
80
79
81
80
this .scrollHandler = function scrollHandlerOriginal () {
90
89
91
90
setTimeout (this .scrollHandler , 1 );
92
91
this .scrollParent .addEventListener (' scroll' , this .scrollHandler );
93
- },
94
- events: {
95
- ' $InfiniteLoading:loaded ' : function loaded () {
92
+
93
+ this .$on (' $InfiniteLoading:loaded' , () => {
96
94
this .isLoading = false ;
97
95
this .isFirstLoad = false ;
98
- },
99
- ' $InfiniteLoading:complete ' : function complete () {
96
+ });
97
+ this . $on ( ' $InfiniteLoading:complete' , () => {
100
98
this .isLoading = false ;
101
99
this .isComplete = true ;
102
100
this .scrollParent .removeEventListener (' scroll' , this .scrollHandler );
103
- },
104
- ' $InfiniteLoading:reset ' : function reset () {
101
+ });
102
+ this . $on ( ' $InfiniteLoading:reset' , () => {
105
103
this .isLoading = false ;
106
104
this .isComplete = false ;
107
105
this .isFirstLoad = true ;
108
106
this .scrollParent .addEventListener (' scroll' , this .scrollHandler );
109
107
setTimeout (this .scrollHandler , 1 );
110
- },
108
+ });
111
109
},
112
110
destroyed () {
113
111
if (! this .isComplete ) {
You can’t perform that action at this time.
0 commit comments