Commit 7cef0826 by lei

1

parent c126913d
No preview for this file type
...@@ -140,17 +140,14 @@ const isFirst = ref(true); ...@@ -140,17 +140,14 @@ 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 ( if (domHeight - cliheight - domTop <= 20 && resultList.value.length >= 19) {
domHeight - cliheight - domTop <= 20 &&
resultList.value.length >= 19
) {
// 滚动到底部 // 滚动到底部
if (hasMorePages.value) { if (hasMorePages.value) {
// 如果当前加载更多已经执行,return // 如果当前加载更多已经执行,return
...@@ -161,7 +158,12 @@ const darg = () => { ...@@ -161,7 +158,12 @@ const darg = () => {
getTokenList(); 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