fix negative index count if list is too small

This commit is contained in:
2023-05-26 13:18:33 +02:00
parent 9446d7ec15
commit c565d1593b
+1 -1
View File
@@ -36,7 +36,7 @@ export default defineComponent({
computed: {
interval () {
// console.log(this.list.length, this.vIndex + this.toLoad)
return [Math.min(this.list.length - this.toLoad, this.vIndex), Math.min(this.vIndex + this.toLoad, this.list.length)]
return [Math.max(Math.min(this.list.length - this.toLoad, this.vIndex), 0), Math.min(this.vIndex + this.toLoad, this.list.length)]
},
visibleList () {
return this.list.slice(this.interval[0], this.interval[1])