hahah
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-12-03 11:18:07 +08:00
parent 9e7485dfa2
commit 4991b3686c
16 changed files with 589 additions and 402 deletions

View File

@@ -43,6 +43,7 @@ class Search {
let input = $(".header input")
$(".header .button").onclick = async () => {
this.page = 1
if (input.value.length != 0) {
this.keyword = input.value
this.totalArr = []
@@ -51,7 +52,13 @@ class Search {
util.hidden(".no-search")
item(".have-search ul", this.totalArr)
util.show(".have-search")
this.onscroll()
onscroll(async () => {
this.page += 1
if (this.page <= this.totalPage) {
await this.getSearchKeyData()
item(".have-search ul", this.totalArr)
}
})
}
}
@@ -75,23 +82,6 @@ class Search {
this.totalPage = totalPage
list.forEach(v => this.totalArr.push(v));
}
// 滚动到底部实现自动加载下一页数据
onscroll() {
window.onscroll = async () => {
var scrollHeight = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
var clientHeight = window.innerHeight || Math.min(document.documentElement.clientHeight, document.body.clientHeight);
if (clientHeight + Math.ceil(scrollTop) >= scrollHeight) {
this.page += 1
if (this.page <= this.totalPage) {
await this.getSearchKeyData()
item(".have-search ul", this.totalArr)
}
}
}
}
}
new Search