-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(LoadMore): add LoadMore component #6436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
69e782d
增加触底加载LoadMore
nhren a2d6650
refactor: 更新示例文档
ArgoZhang a77773b
refactor: 更新使用元素视口逻辑
ArgoZhang 957b01b
chore: 撤销更改
ArgoZhang 7f2242c
chore: 撤销更改
ArgoZhang e4867b3
Merge branch 'doc-ob' into nhren
ArgoZhang dae4456
chore: 移动组件目录
ArgoZhang 1a05a49
doc: 增加多语言支持
ArgoZhang 938768f
refactor: 调整结构精简样式
ArgoZhang 8e4ee57
refactor: 增加逻辑检查
ArgoZhang 0fcd4dc
doc: 增加 LoadMore 示例
ArgoZhang 38f2176
refactor: 更改参数名称提高可读性
ArgoZhang 51234a0
doc: 更新示例文档
ArgoZhang 706402d
feat: 增加阈值参数
ArgoZhang ec882fd
test: 补充 LoadMore 单元测试
ArgoZhang 36be867
doc: 更新文档
ArgoZhang 28a9b2f
chore: bump version 9.8.2-beta02
ArgoZhang 367fe00
Merge branch 'chore-version1' into nhren
ArgoZhang 8932df1
Merge branch 'main' into nhren
ArgoZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <IntersectionObserver OnIntersecting="OnIntersecting" Threshold="1" AutoUnobserveWhenIntersection="false" UseElementViewport="true"> | ||
| <IntersectionObserverItem> | ||
| @if(NumOfCurrentPage < PageSize) | ||
| { | ||
| <div class="nomore">@NoMoreText</div> | ||
| } | ||
| else | ||
| { | ||
| <div class="loading"> | ||
| <Spinner></Spinner> | ||
| </div> | ||
| } | ||
| </IntersectionObserverItem> | ||
| </IntersectionObserver> | ||
|
|
||
| @code { | ||
| /// <summary> | ||
| /// 触底时加载的调用 | ||
| /// </summary> | ||
| [Parameter] public Func<Task>? OnLoadMore { get; set; } | ||
| /// <summary> | ||
| /// 当前页加载的记录数 | ||
| /// </summary> | ||
| [Parameter] public int NumOfCurrentPage{ get; set; } | ||
| /// <summary> | ||
| /// 分页大小 | ||
| /// </summary> | ||
| [Parameter] public int PageSize { get; set; } | ||
| /// <summary> | ||
| /// 没有更多时显示的文字 | ||
| /// </summary> | ||
| [Parameter] public string NoMoreText { get; set; } = "没有更多了"; | ||
| /// <summary> | ||
| /// 触底时加载的调用 | ||
| /// </summary> | ||
| async Task OnIntersecting( IntersectionObserverEntry entry ) | ||
| { | ||
| if(entry.IsIntersecting) | ||
| { | ||
| if(OnLoadMore != null) await OnLoadMore.Invoke(); | ||
| } | ||
| } | ||
| } | ||
14 changes: 14 additions & 0 deletions
14
src/BootstrapBlazor/Components/LoadMore/LoadMore.razor.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| .nomore { | ||
| display: flex; | ||
| justify-content: center; | ||
| padding: 0.5rem 0.5rem 1rem; | ||
| color: #aaa; | ||
| font-size: 0.875rem; | ||
| } | ||
|
|
||
| .loading { | ||
| display: flex; | ||
| justify-content: center; | ||
| padding: 0.5rem 0.5rem 1rem; | ||
| color: #aaa; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
src/BootstrapBlazor/Components/LoadMore/LoadMore.razor.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| .nomore { | ||
| display: flex; | ||
| justify-content: center; | ||
| padding: .5rem .5rem 1rem; | ||
| color: #aaa; | ||
| font-size: .875rem; | ||
| } | ||
ArgoZhang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .loading { | ||
| display: flex; | ||
| justify-content: center; | ||
| padding: .5rem .5rem 1rem; | ||
| color: #aaa; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.