Skip to content

Commit bd9088b

Browse files
committed
refactor: 增加滚动行为参数
1 parent 02fb341 commit bd9088b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/BootstrapBlazor/Components/Select/Select.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
<BootstrapLabel required="@Required" for="@InputId" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
1010
}
11-
<div @attributes="AdditionalAttributes" id="@Id" class="@ClassString">
11+
<div @attributes="AdditionalAttributes" id="@Id" class="@ClassString" data-bb-scroll-behavior="@ScrollIntoViewBehaviorString">
1212
<CascadingValue Value="this" IsFixed="true">
1313
@Options
1414
</CascadingValue>

src/BootstrapBlazor/Components/Select/Select.razor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public partial class Select<TValue> : ISelect, ILookup
6868

6969
private readonly List<SelectedItem> _children = [];
7070

71+
private string? ScrollIntoViewBehaviorString => ScrollIntoViewBehavior == ScrollIntoViewBehavior.Smooth ? null : ScrollIntoViewBehavior.ToDescriptionString();
72+
7173
/// <summary>
7274
/// 获得/设置 右侧清除图标 默认 fa-solid fa-angle-up
7375
/// </summary>

src/BootstrapBlazor/Components/Select/SelectBase.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public abstract class SelectBase<TValue> : PopoverSelectBase<TValue>
5959
[Parameter]
6060
public RenderFragment<string>? GroupItemTemplate { get; set; }
6161

62+
/// <summary>
63+
/// 获得/设置 滚动行为 默认 <see cref="ScrollIntoViewBehavior.Smooth"/>
64+
/// </summary>
65+
[Parameter]
66+
public ScrollIntoViewBehavior ScrollIntoViewBehavior { get; set; } = ScrollIntoViewBehavior.Smooth;
67+
6268
/// <summary>
6369
/// 获得/设置 IIconTheme 服务实例
6470
/// </summary>

0 commit comments

Comments
 (0)