@@ -67,6 +67,10 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
67
67
type : String ,
68
68
default : ''
69
69
} ,
70
+ pageMode : {
71
+ type : Boolean ,
72
+ default : false
73
+ } ,
70
74
start : {
71
75
type : Number ,
72
76
default : 0
@@ -174,14 +178,23 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
174
178
this . delta = delta ;
175
179
} ,
176
180
mounted : function mounted ( ) {
181
+ if ( this . pageMode ) {
182
+ window . addEventListener ( 'scroll' , this . debounce ? _debounce ( this . onScroll . bind ( this ) , this . debounce ) : this . onScroll , false ) ;
183
+ }
184
+
177
185
if ( this . start ) {
178
186
var start = this . getZone ( this . start ) . start ;
179
187
this . setScrollTop ( this . variable ? this . getVarOffset ( start ) : start * this . size ) ;
180
188
} else if ( this . offset ) {
181
189
this . setScrollTop ( this . offset ) ;
182
190
}
183
191
} ,
184
- // check if delta should update when prorps change.
192
+ beforeDestroy : function beforeDestroy ( ) {
193
+ if ( this . pageMode ) {
194
+ window . removeEventListener ( 'scroll' , this . debounce ? _debounce ( this . onScroll . bind ( this ) , this . debounce ) : this . onScroll , false ) ;
195
+ }
196
+ } ,
197
+ // check if delta should update when props change.
185
198
beforeUpdate : function beforeUpdate ( ) {
186
199
var delta = this . delta ;
187
200
delta . keeps = this . remain + ( this . bench || this . remain ) ;
@@ -205,7 +218,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
205
218
onScroll : function onScroll ( event ) {
206
219
var delta = this . delta ;
207
220
var vsl = this . $refs . vsl ;
208
- var offset = ( vsl . $el || vsl ) . scrollTop || 0 ;
221
+ var offset = this . pageMode ? window . pageYOffset : ( vsl . $el || vsl ) . scrollTop || 0 ;
209
222
delta . direction = offset > delta . scrollTop ? 'D' : 'U' ;
210
223
delta . scrollTop = offset ;
211
224
@@ -416,10 +429,14 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
416
429
} ,
417
430
// set manual scroll top.
418
431
setScrollTop : function setScrollTop ( scrollTop ) {
419
- var vsl = this . $refs . vsl ;
432
+ if ( this . pageMode ) {
433
+ window . scrollTo ( 0 , scrollTop ) ;
434
+ } else {
435
+ var vsl = this . $refs . vsl ;
420
436
421
- if ( vsl ) {
422
- ( vsl . $el || vsl ) . scrollTop = scrollTop ;
437
+ if ( vsl ) {
438
+ ( vsl . $el || vsl ) . scrollTop = scrollTop ;
439
+ }
423
440
}
424
441
} ,
425
442
// filter the shown items base on `start` and `end`.
@@ -484,6 +501,18 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
484
501
var _this$delta = this . delta ,
485
502
paddingTop = _this$delta . paddingTop ,
486
503
paddingBottom = _this$delta . paddingBottom ;
504
+
505
+ if ( this . pageMode ) {
506
+ return h ( this . wtag , {
507
+ 'style' : {
508
+ 'display' : 'block' ,
509
+ 'padding-top' : paddingTop + 'px' ,
510
+ 'padding-bottom' : paddingBottom + 'px'
511
+ } ,
512
+ 'class' : this . wclass
513
+ } , list ) ;
514
+ }
515
+
487
516
return h ( this . rtag , {
488
517
'ref' : 'vsl' ,
489
518
'style' : {
0 commit comments