Skip to content

Commit df62775

Browse files
committed
Revert "feat: 增加无数据处理逻辑"
This reverts commit b2cbd76.
1 parent b2cbd76 commit df62775

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040
@if (ShowNoDataTip && Rows.Count == 0)
4141
{
42-
<div class="dropdown-item tip">@NoDataTip</div>
42+
<div class="dropdown-item">@NoDataTip</div>
4343
}
4444
</div>
4545
</div>;

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ protected override void OnParametersSet()
129129
/// Callback method when a candidate item is clicked
130130
/// </summary>
131131
[JSInvokable]
132-
public async Task<string?> TriggerClick(int index)
132+
public async Task TriggerClick(int index)
133133
{
134134
if (index < 0 || index >= Rows.Count)
135135
{
136-
return null;
136+
return;
137137
}
138138

139139
var item = Rows[index];
@@ -150,7 +150,6 @@ protected override void OnParametersSet()
150150
}
151151

152152
await TriggerFilter(Value);
153-
return Value;
154153
}
155154

156155
private List<string> Rows => _filterItems ?? [.. Items];

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,15 @@ export function init(id, invoke, value) {
5151
})
5252
}
5353

54-
EventHandler.on(menu, 'click', '.dropdown-item', async e => {
54+
EventHandler.on(menu, 'click', '.dropdown-item', e => {
5555
const item = e.delegateTarget;
56-
if (item.classList.contains('tip')) {
57-
return;
58-
}
59-
6056
const val = item.getAttribute('data-bb-val');
61-
if (val) {
62-
input.value = val;
63-
}
57+
input.value = val;
6458
ac.close();
6559

6660
const items = [...item.parentElement.children];
6761
const index = items.indexOf(item);
68-
const text = await invoke.invokeMethodAsync('TriggerClick', index);
69-
if (input.value !== text) {
70-
input.value = text;
71-
}
62+
invoke.invokeMethodAsync('TriggerClick', index);
7263
});
7364

7465
EventHandler.on(input, 'focus', e => {

0 commit comments

Comments
 (0)