Skip to content

Commit 3f5f2e0

Browse files
committed
Build
1 parent 0017599 commit 3f5f2e0

33 files changed

+44
-42
lines changed

dist/index.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-virtual-scroll-list v2.0.3
2+
* vue-virtual-scroll-list v2.0.4
33
* open source under the MIT license
44
* https://github.com/tangbc/vue-virtual-scroll-list#readme
55
*/
@@ -364,23 +364,24 @@
364364
*/
365365
var VirtualProps = {
366366
size: {
367-
type: Number
367+
type: Number,
368+
required: true
368369
},
369370
keeps: {
370371
type: Number,
371-
require: true
372+
required: true
372373
},
373374
dataKey: {
374375
type: String,
375-
require: true
376+
required: true
376377
},
377378
dataSources: {
378379
type: Array,
379-
require: true
380+
required: true
380381
},
381382
dataComponent: {
382383
type: Object,
383-
require: true
384+
required: true
384385
},
385386
extraProps: {
386387
type: Object
@@ -402,11 +403,11 @@
402403
"default": 'vertical' // the other value is horizontal.
403404

404405
},
405-
upperThreshold: {
406+
topThreshold: {
406407
type: Number,
407408
"default": 0
408409
},
409-
lowerThreshold: {
410+
bottomThreshold: {
410411
type: Number,
411412
"default": 0
412413
},
@@ -595,9 +596,7 @@
595596
buffer: Math.round(this.keeps / 3),
596597
// recommend for a third of keeps.
597598
uniqueIds: this.getUniqueIdFromDataSources()
598-
}, this.onRangeChanged); // just for debug
599-
// window.virtual = this.virtual
600-
// also need sync initial range first.
599+
}, this.onRangeChanged); // also need sync initial range first.
601600

602601
this.range = this.virtual.getRange(); // listen item size changing.
603602

@@ -647,8 +646,15 @@
647646
}
648647

649648
var offset = root[this.directionKey];
649+
var offsetShape = root[this.isHorizontal ? 'clientWidth' : 'clientHeight'];
650+
var scrollShape = root[this.isHorizontal ? 'scrollWidth' : 'scrollHeight']; // iOS scrolling spring-back behavior will make direction mistake.
651+
652+
if (offset + offsetShape > scrollShape) {
653+
return;
654+
}
655+
650656
this.virtual.handleScroll(offset);
651-
this.emitEvent(offset, evt);
657+
this.emitEvent(offset, offsetShape, scrollShape, evt);
652658
},
653659
getUniqueIdFromDataSources: function getUniqueIdFromDataSources() {
654660
var _this = this;
@@ -666,18 +672,14 @@
666672
}
667673
},
668674
// emit event in special position.
669-
emitEvent: function emitEvent(offset, evt) {
670-
// ref element is definitely available here.
671-
var root = this.$refs.root;
675+
emitEvent: function emitEvent(offset, offsetShape, scrollShape, evt) {
672676
var range = this.virtual.getRange();
673677
var isFront = this.virtual.isFront();
674678
var isBehind = this.virtual.isBehind();
675-
var offsetShape = root[this.isHorizontal ? 'clientWidth' : 'clientHeight'];
676-
var scrollShape = root[this.isHorizontal ? 'scrollWidth' : 'scrollHeight'];
677679

678-
if (isFront && !!this.dataSources.length && offset - this.upperThreshold <= 0) {
680+
if (isFront && !!this.dataSources.length && offset - this.topThreshold <= 0) {
679681
this.$emit('totop', evt, range);
680-
} else if (isBehind && offset + offsetShape + this.lowerThreshold >= scrollShape) {
682+
} else if (isBehind && offset + offsetShape + this.bottomThreshold >= scrollShape) {
681683
this.$emit('tobottom', evt, range);
682684
} else {
683685
this.$emit('scroll', evt, range);

docs/css/app.2f54a158.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/app.3f263f69.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/css/infinite-loading.404ee309.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/css/infinite-loading.97a34685.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/keep-state.23037f2b.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/css/keep-state.8ff34da6.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><title>vue-virtual-scroll-list</title><link rel=icon href=favicon.png><link rel=stylesheet href=milligram.css><link rel=stylesheet href=highlight/theme.css><script src=highlight/pack.js></script><script>hljs.initHighlightingOnLoad()</script><link href=css/dynamic-size.681ebb77.css rel=prefetch><link href=css/fixed-size.840ec49f.css rel=prefetch><link href=css/horizontal.c4223f3f.css rel=prefetch><link href=css/infinite-loading.404ee309.css rel=prefetch><link href=css/keep-state.8ff34da6.css rel=prefetch><link href=js/dynamic-size.2109cee7.js rel=prefetch><link href=js/dynamic-size~fixed-size~horizontal~infinite-loading~keep-state.3b940789.js rel=prefetch><link href=js/fixed-size.92c37058.js rel=prefetch><link href=js/horizontal.2cab1358.js rel=prefetch><link href=js/infinite-loading.0325de6f.js rel=prefetch><link href=js/keep-state.e8cb2a02.js rel=prefetch><link href=css/app.3f263f69.css rel=preload as=style><link href=js/app.a94dd9f8.js rel=preload as=script><link href=js/chunk-vendors.a8fb041f.js rel=preload as=script><link href=css/app.3f263f69.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.a8fb041f.js></script><script src=js/app.a94dd9f8.js></script></body></html>
1+
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><title>vue-virtual-scroll-list</title><link rel=icon href=favicon.png><link rel=stylesheet href=milligram.css><link rel=stylesheet href=highlight/theme.css><script src=highlight/pack.js></script><script>hljs.initHighlightingOnLoad()</script><link href=css/dynamic-size.681ebb77.css rel=prefetch><link href=css/fixed-size.840ec49f.css rel=prefetch><link href=css/horizontal.c4223f3f.css rel=prefetch><link href=css/infinite-loading.97a34685.css rel=prefetch><link href=css/keep-state.23037f2b.css rel=prefetch><link href=js/dynamic-size.6e4c0bb1.js rel=prefetch><link href=js/dynamic-size~fixed-size~horizontal~infinite-loading~keep-state.3b940789.js rel=prefetch><link href=js/fixed-size.9af085f6.js rel=prefetch><link href=js/horizontal.78fb7150.js rel=prefetch><link href=js/infinite-loading.46cb102a.js rel=prefetch><link href=js/keep-state.0b3dbbf4.js rel=prefetch><link href=css/app.2f54a158.css rel=preload as=style><link href=js/app.48509246.js rel=preload as=script><link href=js/chunk-vendors.a8fb041f.js rel=preload as=script><link href=css/app.2f54a158.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.a8fb041f.js></script><script src=js/app.48509246.js></script></body></html>

docs/js/app.48509246.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/app.48509246.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)