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

@@ -101,9 +101,6 @@ class Utils {
if (r != null) return decodeURIComponent(r[2]); return null;
}
header(content, action, back = `<i class="iconfont icon-fanhui"></i>`) {
this.$("body").insertAdjacentHTML('afterbegin', `
<div class="header fixed flex ais flex1 border-box p15">
@@ -118,6 +115,19 @@ class Utils {
}
}
// 滚动到底部实现自动加载下一页数据
onscroll(callback) {
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) {
callback()
}
}
}
async navShare(title = "", text = "", url = "") {
console.log(navigator.share && navigator.canShare);
@@ -145,13 +155,18 @@ class Utils {
}
getItem(key) {
let local = localStorage.getItem(key)
return local ? JSON.parse(local) : []
let local = localStorage.getItem(key)
return local ? JSON.parse(local) : []
}
}
let u = new Utils
let util = u, { $, item, query, navShare, getItem, setItem } = u
let util = u,
{
$, item, query, navShare,
getItem, setItem, onscroll
}
= u
// let util = new Utils
// let $ = (new Utils).$