Skip to content

Commit eb54308

Browse files
committed
perf: 优化性能
1 parent 4398d92 commit eb54308

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
data-bs-toggle="@ToggleString" data-bs-placement="@PlacementString"
1111
data-bs-offset="@OffsetString" data-bs-custom-class="@CustomClassString"
1212
data-bb-auto-dropdown-focus="@ShowDropdownListOnFocusString" data-bb-debounce="@DurationString"
13-
data-bb-skip-esc="@SkipEscString" data-bb-skip-enter="@SkipEnterString"
13+
data-bb-skip-esc="@SkipEscString" data-bb-skip-enter="@SkipEnterString" data-bb-blur="@TriggerBlurString"
1414
data-bb-scroll-behavior="@ScrollIntoViewBehaviorString"
1515
value="@CurrentValueAsString"
1616
placeholder="@PlaceHolder" disabled="@Disabled" @ref="FocusElement"/>

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ export function init(id, invoke) {
9797
const id = a.getAttribute('id');
9898
const ac = Data.get(id);
9999
if (ac) {
100-
ac.invoke.invokeMethodAsync('TriggerBlur');
100+
const { invoke, input } = ac;
101+
const triggerBlur = input.getAttribute('data-bb-blur') === 'true';
102+
if (triggerBlur) {
103+
invoke.invokeMethodAsync('TriggerBlur');
104+
}
101105
}
102106
}
103107
});

src/BootstrapBlazor/Components/AutoComplete/PopoverCompleteBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ public abstract class PopoverCompleteBase<TValue> : BootstrapInputBase<TValue>,
101101
/// </summary>
102102
protected string? SkipEnterString => SkipEnter ? "true" : null;
103103

104+
/// <summary>
105+
/// 获得 是否跳过 Blur 处理字符串
106+
/// </summary>
107+
protected string? TriggerBlurString => OnBlurAsync != null ? "true" : null;
108+
104109
/// <summary>
105110
/// 获得 滚动行为字符串
106111
/// </summary>

0 commit comments

Comments
 (0)