Commit 7cef0826 by lei

1

parent c126913d
No preview for this file type
...@@ -140,28 +140,30 @@ const isFirst = ref(true); ...@@ -140,28 +140,30 @@ const isFirst = ref(true);
const PopupMaxHeight = ref<number>(800); const PopupMaxHeight = ref<number>(800);
// 搜索结果box高度 // 搜索结果box高度
const search_list_height = ref<number>(0); const search_list_height = ref<number>(0);
const darg = () => { // 滚动事件
const SrcollEvent = () => {
let dom: any = document.getElementById("search-token-list"); let dom: any = document.getElementById("search-token-list");
if (dom !== null) { if (dom) {
dom.addEventListener("scroll", () => { let domHeight = dom.scrollHeight;
let domHeight = dom.scrollHeight; let domTop = dom.scrollTop;
let domTop = dom.scrollTop; let cliheight = dom.clientHeight;
let cliheight = dom.clientHeight; if (domHeight - cliheight - domTop <= 20 && resultList.value.length >= 19) {
if ( // 滚动到底部
domHeight - cliheight - domTop <= 20 && if (hasMorePages.value) {
resultList.value.length >= 19 // 如果当前加载更多已经执行,return
) { if (loadingMore.value) {
// 滚动到底部 return;
if (hasMorePages.value) {
// 如果当前加载更多已经执行,return
if (loadingMore.value) {
return;
}
loadingMore.value = true;
getTokenList();
} }
loadingMore.value = true;
getTokenList();
} }
}); }
}
};
const darg = () => {
let dom: any = document.getElementById("search-token-list");
if (dom) {
dom.addEventListener("scroll", SrcollEvent);
} }
}; };
const getHeight = () => { const getHeight = () => {
...@@ -194,6 +196,12 @@ onMounted(() => { ...@@ -194,6 +196,12 @@ onMounted(() => {
getHeight(); getHeight();
}); });
}); });
onBeforeUnmount(() => {
let dom: any = document.getElementById("search-token-list");
if (dom) {
dom.removeEventListener("scroll", SrcollEvent);
}
});
const onChange = (value: string) => { const onChange = (value: string) => {
keyword.value = value; keyword.value = value;
getTokenList(); getTokenList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment