mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-17 23:01:23 +00:00
fix: scrolling pagination errors
This commit is contained in:
parent
2f9a22f41a
commit
f7c4c7ec6a
2 changed files with 6 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "4.1.4",
|
||||
"version": "4.1.5",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "build/main.js",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
import smoothScroll from '@/modules/scroll.js'
|
||||
import { debounce } from '@/modules/util.js'
|
||||
|
||||
let page = 1
|
||||
let page = 0
|
||||
items.value = []
|
||||
hasNextPage.value = true
|
||||
|
||||
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
function loadSearchData () {
|
||||
const load = $search.load || Sections.createFallbackLoad()
|
||||
const nextData = load(page, undefined, searchCleanup($search))
|
||||
const nextData = load(++page, undefined, searchCleanup($search))
|
||||
$items = [...$items, ...nextData]
|
||||
return nextData[nextData.length - 1].data
|
||||
}
|
||||
const update = debounce(() => {
|
||||
page = 1
|
||||
page = 0
|
||||
items.value = []
|
||||
key = {}
|
||||
loadSearchData()
|
||||
|
|
@ -37,14 +37,15 @@
|
|||
|
||||
async function loadTillFull (element) {
|
||||
while (hasNextPage.value && element.scrollHeight <= element.clientHeight) {
|
||||
canScroll = false
|
||||
await loadSearchData()
|
||||
}
|
||||
canScroll = true
|
||||
}
|
||||
|
||||
async function infiniteScroll () {
|
||||
if (canScroll && $hasNextPage && this.scrollTop + this.clientHeight > this.scrollHeight - 800) {
|
||||
canScroll = false
|
||||
page++
|
||||
await loadSearchData()
|
||||
canScroll = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue