@@ -67,6 +67,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
67
67
type : String ,
68
68
"default" : ''
69
69
} ,
70
+ wstyle : {
71
+ type : Object ,
72
+ "default" : function _default ( ) {
73
+ return { } ;
74
+ }
75
+ } ,
70
76
pagemode : {
71
77
type : Boolean ,
72
78
"default" : false
@@ -98,17 +104,15 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
98
104
} ,
99
105
totop : {
100
106
type : [ Function , Boolean ] ,
101
- // Boolean just disable for priviate.
102
107
"default" : false
103
108
} ,
104
109
tobottom : {
105
110
type : [ Function , Boolean ] ,
106
- // Boolean just disable for priviate.
107
111
"default" : false
108
112
} ,
109
113
onscroll : {
110
114
type : [ Function , Boolean ] ,
111
- // Boolean just disable for priviate.
115
+ // Boolean disables default behavior
112
116
"default" : false
113
117
} ,
114
118
istable : {
@@ -130,7 +134,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
130
134
"default" : function _default ( ) { }
131
135
}
132
136
} ,
133
- // use changeProp to identify which prop change.
137
+ // use changeProp to identify the prop change.
134
138
watch : {
135
139
size : function size ( ) {
136
140
this . changeProp = 'size' ;
@@ -305,14 +309,14 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
305
309
}
306
310
307
311
var zone = this . getZone ( overs ) ;
308
- var bench = this . bench || this . remain ; // for better performance, if scroll pass items within now bench, do not update.
309
- // and if overs is going to reach last item, we should render next zone immediately.
312
+ var bench = this . bench || this . remain ; // for better performance, if scroll passes items within the bench, do not update.
313
+ // and if it's close to the last item, render next zone immediately.
310
314
311
315
var shouldRenderNextZone = Math . abs ( overs - delta . start - bench ) === 1 ;
312
316
313
317
if ( ! shouldRenderNextZone && overs - delta . start <= bench && ! zone . isLast && overs > delta . start ) {
314
318
return ;
315
- } // we'd better make sure forceRender calls as less as possible.
319
+ } // make sure forceRender calls as less as possible.
316
320
317
321
318
322
if ( shouldRenderNextZone || zone . start !== delta . start || zone . end !== delta . end ) {
@@ -321,7 +325,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
321
325
this . forceRender ( ) ;
322
326
}
323
327
} ,
324
- // return the right zone info base on `start/index`.
328
+ // return the right zone info based on `start/index`.
325
329
getZone : function getZone ( index ) {
326
330
var start ;
327
331
var delta = this . delta ;
@@ -342,8 +346,8 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
342
346
isLast : isLast
343
347
} ;
344
348
} ,
345
- // public method, force render ui list if we needed.
346
- // call this before the next repaint to get better performance.
349
+ // public method, force render ui list if needed.
350
+ // call this before the next rerender to get better performance.
347
351
forceRender : function forceRender ( ) {
348
352
var _this = this ;
349
353
@@ -357,7 +361,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
357
361
this . forceRender ( ) ;
358
362
}
359
363
} ,
360
- // return the scroll passed items count in variable.
364
+ // return the scroll of passed items count in variable.
361
365
getVarOvers : function getVarOvers ( offset ) {
362
366
var low = 0 ;
363
367
var middle = 0 ;
@@ -432,27 +436,27 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
432
436
433
437
return 0 ;
434
438
} ,
435
- // return the variable paddingTop base current zone.
439
+ // return the variable paddingTop based on current zone.
436
440
// @todo : if set a large `start` before variable was calculated,
437
441
// here will also case too much offset calculate when list is very large,
438
442
// consider use estimate paddingTop in this case just like `getVarPaddingBottom`.
439
443
getVarPaddingTop : function getVarPaddingTop ( ) {
440
444
return this . getVarOffset ( this . delta . start ) ;
441
445
} ,
442
- // return the variable paddingBottom base current zone.
446
+ // return the variable paddingBottom based on the current zone.
443
447
getVarPaddingBottom : function getVarPaddingBottom ( ) {
444
448
var delta = this . delta ;
445
449
var last = delta . total - 1 ;
446
450
447
451
if ( delta . total - delta . end <= delta . keeps || delta . varLastCalcIndex === last ) {
448
452
return this . getVarOffset ( last ) - this . getVarOffset ( delta . end ) ;
449
453
} else {
450
- // if unreached last zone or uncalculate real behind offset
451
- // return the estimate paddingBottom avoid too much calculate .
454
+ // if unreached last zone or uncalculated real behind offset
455
+ // return the estimate paddingBottom and avoid too much calculations .
452
456
return ( delta . total - delta . end ) * ( delta . varAverSize || this . size ) ;
453
457
}
454
458
} ,
455
- // retun the variable all heights use to judge reach bottom.
459
+ // return the variable all heights use to judge reach bottom.
456
460
getVarAllHeight : function getVarAllHeight ( ) {
457
461
var delta = this . delta ;
458
462
@@ -464,7 +468,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
464
468
} ,
465
469
// public method, allow the parent update variable by index.
466
470
updateVariable : function updateVariable ( index ) {
467
- // clear/update all the offfsets and heights ahead of index.
471
+ // clear/update all the offsets and heights ahead of index.
468
472
this . getVarOffset ( index , true ) ;
469
473
} ,
470
474
// trigger a props event on parent.
@@ -487,10 +491,10 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
487
491
}
488
492
}
489
493
} ,
490
- // filter the shown items base on `start` and `end`.
494
+ // filter the shown items based on `start` and `end`.
491
495
filter : function filter ( h ) {
492
496
var delta = this . delta ;
493
- var slots = this . $slots [ "default" ] || [ ] ; // item-mode shoud judge from items prop.
497
+ var slots = this . $slots [ "default" ] || [ ] ; // item-mode should be decided from items prop.
494
498
495
499
if ( this . item || this . $scopedSlots . item ) {
496
500
delta . total = this . itemcount ;
@@ -560,16 +564,16 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
560
564
}
561
565
562
566
var renderList = h ( wtag , {
563
- style : {
567
+ style : Object . assign ( {
564
568
display : 'block' ,
565
569
'padding-top' : paddingTop + 'px' ,
566
570
'padding-bottom' : paddingBottom + 'px'
567
- } ,
571
+ } , this . wstyle ) ,
568
572
"class" : this . wclass ,
569
573
attrs : {
570
574
role : 'group'
571
575
}
572
- } , list ) ; // page mode just render list, no wraper .
576
+ } , list ) ; // page mode just render list, no wrapper .
573
577
574
578
if ( this . pagemode || this . scrollelement ) {
575
579
return renderList ;
@@ -579,7 +583,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
579
583
ref : 'vsl' ,
580
584
style : {
581
585
display : 'block' ,
582
- 'overflow-y' : this . size >= this . remain ? 'auto' : 'inital ' ,
586
+ 'overflow-y' : this . size >= this . remain ? 'auto' : 'initial ' ,
583
587
height : this . size * this . remain + 'px'
584
588
} ,
585
589
on : {
0 commit comments