Skip to content

Commit

Permalink
Fixed end index calc error when list clear. #119
Browse files Browse the repository at this point in the history
  • Loading branch information
tangbc committed Aug 12, 2019
1 parent cd85dff commit 1c26543
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
var isLast = index <= delta.total && index >= lastStart || index > delta.total;

if (isLast) {
end = delta.total - 1;
start = Math.max(0, lastStart);
} else {
start = index;
end = start + delta.keeps - 1;
}

end = start + delta.keeps - 1;
return {
end: end,
start: start,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-virtual-scroll-list",
"version": "1.4.1",
"version": "1.4.2",
"description": "A vue component support big amount data list with high scroll performance.",
"main": "dist/index.js",
"files": [
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@
const lastStart = delta.total - delta.keeps
const isLast = (index <= delta.total && index >= lastStart) || (index > delta.total)
if (isLast) {
end = delta.total - 1
start = Math.max(0, lastStart)
} else {
start = index
end = start + delta.keeps - 1
}

end = start + delta.keeps - 1

return {
end,
start,
Expand Down

0 comments on commit 1c26543

Please sign in to comment.