Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rrpgLink_FrontEnd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kesaubeeire
rrpgLink_FrontEnd
Commits
3c7733aa
Commit
3c7733aa
authored
Oct 23, 2023
by
KesaubeEire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 瀑布流细节改进
parent
a068678a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
src/Content.svelte
src/Content.svelte
+29
-7
No files found.
src/Content.svelte
View file @
3c7733aa
...
...
@@ -174,8 +174,12 @@
}
isSearching = true;
globalPageLimit = limit;
//
globalPageLimit = limit;
nextPage = page;
// 是否两次搜索参数相同
let sameSearch = lastSearchParam == searchParam && lastSearchType == searchType;
lastSearchType = searchType;
lastSearchParam = searchParam;
...
...
@@ -199,12 +203,20 @@
createFetch(requestType(searchParam), data => {
if (process.env.APP_ENV === 'dev') console.log(data);
if (data.length != 0) {
page == 1 ? showList(data) : appendList(data);
} else {
toast.push('没有搜索到数据捏~');
return;
}
if (data.length < globalPageLimit) {
console.log(data.length);
isEnd = true;
toast.push('没有更多数据了捏~');
if (sameSearch) isEnd = true;
toast.push('加载完成了捏~');
return;
}
...
...
@@ -296,12 +308,22 @@
//拉动到页面底部则更新数据
window.addEventListener('scroll', () => {
// 加载下一页: page + 1 重复上次搜
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
if (clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight - 10.0) {
// 加载下一页: page + 1 重复上次搜
// continueLastSearch();
// PC 端
// if (clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight - 10.0) debouncedContinue();
// 手机端
// if (window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 10.0) debouncedContinue();
let pc_debounced = clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight - 10.0;
let phone_debounced = window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 10.0;
if (pc_debounced || phone_debounced) {
// toast.push(pc_debounced ? 'pc' : 'phone');
debouncedContinue();
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment