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
254372ce
Commit
254372ce
authored
Oct 25, 2023
by
KesaubeEire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 瀑布流加载细节优化 & 增加请求卡片的 loading 动画.
parent
9865790e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
src/Content.svelte
src/Content.svelte
+20
-8
No files found.
src/Content.svelte
View file @
254372ce
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
/**上次搜索请求头封装对象*/
/**上次搜索请求头封装对象*/
let lastSearchParam = null;
let lastSearchParam = null;
/**瀑布流底部检测距离 320 | 10*/
const distance = 10;
// -----------------------------
// -----------------------------
// 各种请求封装头 & 请求函数
// 各种请求封装头 & 请求函数
...
@@ -315,13 +318,13 @@
...
@@ -315,13 +318,13 @@
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
// PC 端
// PC 端
// if (clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight -
10.0
) debouncedContinue();
// if (clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight -
distance
) debouncedContinue();
// 手机端
// 手机端
// if (window.scrollY + window.innerHeight >= document.documentElement.scrollHeight -
10.0
) debouncedContinue();
// if (window.scrollY + window.innerHeight >= document.documentElement.scrollHeight -
distance
) debouncedContinue();
let pc_debounced = clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight -
10.0
;
let pc_debounced = clientHeight > 0 && scrollTop > 0 && scrollTop + clientHeight > scrollHeight -
distance
;
let phone_debounced = window.scrollY + window.innerHeight >= document.documentElement.scrollHeight -
10.0
;
let phone_debounced = window.scrollY + window.innerHeight >= document.documentElement.scrollHeight -
distance
;
if (pc_debounced || phone_debounced) {
if (pc_debounced || phone_debounced) {
// toast.push(pc_debounced ? 'pc' : 'phone');
// toast.push(pc_debounced ? 'pc' : 'phone');
debouncedContinue();
debouncedContinue();
...
@@ -337,10 +340,11 @@
...
@@ -337,10 +340,11 @@
<!-- Open the modal using ID.showModal() method -->
<!-- Open the modal using ID.showModal() method -->
<!-- <button class="btn" onclick="globalModal.showModal()">open modal</button> -->
<!-- <button class="btn" onclick="globalModal.showModal()">open modal</button> -->
<!-- NOTE: 游戏详情预览模态框 -->
<dialog id="globalModal" class="modal focus:outline-none">
<dialog id="globalModal" class="modal focus:outline-none">
{#if $_detailWindow}
{#if $_detailWindow}
<div class="globalModal max-[1024px]:w-[98vw] max-[1024px]:max-w-[98vw]" transition:fade={{ delay: 0, duration: 500 }}>
<div class="globalModal max-[1024px]:w-[98vw] max-[1024px]:max-w-[98vw]" transition:fade={{ delay: 0, duration: 500 }}>
<!-- NOTE: 按钮退出详情 -->
<!--
|--
NOTE: 按钮退出详情 -->
<form method="dialog">
<form method="dialog">
<button
<button
on:click={() => {
on:click={() => {
...
@@ -349,7 +353,7 @@
...
@@ -349,7 +353,7 @@
class="btn btn-sm round-box btn-ghost absolute right-2 top-2">✕</button
class="btn btn-sm round-box btn-ghost absolute right-2 top-2">✕</button
>
>
</form>
</form>
<!-- NOTE: Transition -->
<!--
|--
NOTE: Transition -->
{#if $_detailPics.length}
{#if $_detailPics.length}
<div class="carousel w-full" style="height: calc(80vh - 4rem - 3rem - 0.5rem);">
<div class="carousel w-full" style="height: calc(80vh - 4rem - 3rem - 0.5rem);">
{#each $_detailPics as pic, index}
{#each $_detailPics as pic, index}
...
@@ -367,13 +371,13 @@
...
@@ -367,13 +371,13 @@
{/each}
{/each}
</div>
</div>
{:else}
{:else}
<!-- NOTE: loading -->
<!--
|--
NOTE: loading -->
<div class="h-full w-full flex justify-center items-center">
<div class="h-full w-full flex justify-center items-center">
<span class="loading loading-infinity loading-lg" />
<span class="loading loading-infinity loading-lg" />
</div>
</div>
{/if}
{/if}
</div>
</div>
<!-- NOTE: 边框退出详情 -->
<!--
|--
NOTE: 边框退出详情 -->
<form method="dialog" class="modal-backdrop">
<form method="dialog" class="modal-backdrop">
<button
<button
on:click={() => {
on:click={() => {
...
@@ -384,6 +388,7 @@
...
@@ -384,6 +388,7 @@
{/if}
{/if}
</dialog>
</dialog>
<!-- NOTE: 游戏卡片主渲染区 -->
{#if List.length}
{#if List.length}
<div class="cardContainer justify-evenly gap-4 my-3" transition:fade={{ delay: 0, duration: 300 }}>
<div class="cardContainer justify-evenly gap-4 my-3" transition:fade={{ delay: 0, duration: 300 }}>
<!-- 示例卡片, 留着 -->
<!-- 示例卡片, 留着 -->
...
@@ -408,6 +413,13 @@
...
@@ -408,6 +413,13 @@
</div>
</div>
{/if}
{/if}
<!-- NOTE: 加载卡片 Loading 区 -->
{#if isSearching}
<div class="h-full w-full flex justify-center items-center" transition:fade={{ delay: 0, duration: 300 }}>
<span class="loading loading-infinity loading-lg" />
</div>
{/if}
<style>
<style>
/* NOTE: 对 Modal 的究极魔改, 很不容易. */
/* NOTE: 对 Modal 的究极魔改, 很不容易. */
.globalModal {
.globalModal {
...
...
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