Skip to content

Commit 927d587

Browse files
committed
feat: 改用 focus 自定义方法
1 parent c5b782f commit 927d587

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/BootstrapBlazor/Components/Input/BootstrapInput.razor.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import EventHandler from "../../modules/event-handler.js"
22

3+
export function focus(id) {
4+
const el = document.getElementById(id)
5+
if (el) {
6+
el.focus();
7+
}
8+
}
9+
310
export function clear(id) {
411
const el = document.getElementById(id)
512
if (el) {

src/BootstrapBlazor/Components/Input/BootstrapInputBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public abstract class BootstrapInputBase<TValue> : ValidateBase<TValue>
9797
/// Method to focus the element
9898
/// </summary>
9999
/// <returns></returns>
100-
public async Task FocusAsync() => await FocusElement.FocusAsync();
100+
public async Task FocusAsync() => await InvokeVoidAsync("focus", GetInputId());
101101

102102
/// <summary>
103103
/// Method to select all text

0 commit comments

Comments
 (0)