Skip to content

Commit c8bc51a

Browse files
authored
refactor(LoadMore): use UseElementViewport false value (#6440)
* refactor: 更新默认设置 * refactor: 增加 UseElementViewport 参数设置 * refactor: 更改默认值为 false * doc: 更新注释 * refactor: 移除冗余参数 * doc: 格式化文档 * refactor: 更改默认值为 true * refactor: 设置 UseElementViewport 值 false
1 parent 5e3dab8 commit c8bc51a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/BootstrapBlazor.Server/Components/Samples/IntersectionObservers.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
<p>@((MarkupString)Localizer["IntersectionObserverThresholdDesc"].Value)</p>
9393
<div class="text-center">@_thresholdValueString</div>
9494
</section>
95-
<IntersectionObserver OnIntersecting="OnThresholdChanged" Threshold="0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1" AutoUnobserveWhenIntersection="false">
95+
<IntersectionObserver OnIntersecting="OnThresholdChanged" Threshold="0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1"
96+
AutoUnobserveWhenIntersection="false">
9697
<div class="bb-list-load scroll" style="height: 200px;">
9798
<div class="d-flex" style="height: 600px; justify-content: center; align-items: center;">
9899
<IntersectionObserverItem>
@@ -118,8 +119,7 @@
118119
</div>
119120
}
120121
</div>
121-
<LoadMore OnLoadMoreAsync="OnLoadMoreItemAsync" CanLoading="_canLoading">
122-
</LoadMore>
122+
<LoadMore OnLoadMoreAsync="OnLoadMoreItemAsync" CanLoading="_canLoading"></LoadMore>
123123
</div>
124124
</DemoBlock>
125125

src/BootstrapBlazor/Components/IntersectionObserver/IntersectionObserver.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ namespace BootstrapBlazor.Components;
1111
public partial class IntersectionObserver
1212
{
1313
/// <summary>
14-
/// 获得/设置 是否使用元素视口作为根元素 默认为 false 使用浏览器视口作为根元素
15-
/// <para>The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. Defaults to the browser viewport if value is false. Default value is false</para>
14+
/// 获得/设置 是否使用元素视口作为根元素 默认为 true 使用当前元素作为根元素
15+
/// <para>The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. Defaults to the browser viewport if value is false. Default value is true</para>
1616
/// </summary>
1717
[Parameter]
18-
public bool UseElementViewport { get; set; }
18+
public bool UseElementViewport { get; set; } = true;
1919

2020
/// <summary>
2121
/// Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). The values can be percentages. This set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. Defaults to all zeros.

src/BootstrapBlazor/Components/IntersectionObserver/LoadMore.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@namespace BootstrapBlazor.Components
22
@inherits BootstrapModuleComponentBase
33

4-
<IntersectionObserver OnIntersecting="OnIntersecting" Threshold="@Threshold" AutoUnobserveWhenIntersection="false">
4+
<IntersectionObserver OnIntersecting="OnIntersecting" Threshold="@Threshold" AutoUnobserveWhenIntersection="false"
5+
UseElementViewport="false">
56
<IntersectionObserverItem>
67
<div class="bb-intersection-loading">
78
@if (CanLoading)

0 commit comments

Comments
 (0)