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
0e55277f
Commit
0e55277f
authored
Oct 22, 2023
by
JoyJ
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish: 瀑布流,修正page跳跃bug
parent
d73aedd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
src/Content.svelte
src/Content.svelte
+12
-6
No files found.
src/Content.svelte
View file @
0e55277f
...
...
@@ -12,7 +12,7 @@
let nextPage = 1;
//NextPage指示瀑布流下次应请求的limit数
let globalPageLimit = 20;
//若isEnd(已经没有新的结果了)则
滚动到最底不再请求下一页的数据
//若isEnd(已经没有新的结果了)则
暂停瀑布流请求
let isEnd = false;
// -----------------------------
...
...
@@ -102,6 +102,7 @@
// console.log(data);
if (!data.length) {
isEnd = true;
isSearching = false;
toast.push('没有更多数据了捏~');
return;
}
...
...
@@ -127,6 +128,8 @@
*/
function showList(data) {
// List = [...List, ...data];
List = [];
window.scrollTo(0,0);
// <!-- FIXME: 暂时以这种略微丑陋的方式做切换动画, 可能这就是唯一方案了 -->
setTimeout(() => {
...
...
@@ -138,11 +141,12 @@
/**渲染 & 更新视图
* @param data JSON数据
*/
function appendList(data) {
showList([...List, ...data]);
function appendList(data) {
let newData = [...List, ...data];
List = [...newData];
isSearching = false;
}
let lastSearchFunc = null;
let lastSearchType = '';
let lastSearchParam = null;
let isSearching = false;
...
...
@@ -158,7 +162,7 @@
isSearching = true;
isEnd = false;
globalPageLimit = limit;
nextPage = page
+ 1
;
nextPage = page;
lastSearchType = searchType;
lastSearchParam = searchParam;
...
...
@@ -176,6 +180,8 @@
break;
}
debugMessage(requestType(searchParam));
createFetch(requestType(searchParam), data => {
debugMessage(data);
page == 1 ? showList(data) : appendList(data);
...
...
@@ -272,7 +278,7 @@
}
});
// 初始化请求 -> 拉取全部条目
searchDefault(
);
performSearch('','',globalPageLimit,1
);
</script>
<!-- ----------------------------------------------- DOM ----------------------------------------------- -->
...
...
Kesaubeeire
@Kesa
mentioned in commit
c9770aed
·
Oct 23, 2023
mentioned in commit
c9770aed
mentioned in commit c9770aed19c8c46ae1e0e3db0ee91ad5eb073eee
Toggle commit list
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