Skip to content

Commit 3823aff

Browse files
ArgoZhangbraia123
andauthored
feat(OtpInput): support android device (#7517)
* Update OtpInput.razor.js 增加手机端连续输入自动跳转,安卓端退格需要按两次backspace问题未修复 * chore: 调整时间间隔 --------- Co-authored-by: braia123 <guanxin_11@126.com>
1 parent f6e7d97 commit 3823aff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EventHandler from '../../modules/event-handler.js'
1+
import EventHandler from '../../modules/event-handler.js'
22

33
export function init(id, invoke, method) {
44
const el = document.getElementById(id);
@@ -9,6 +9,9 @@ export function init(id, invoke, method) {
99
e.target.value = e.target.value.slice(1, 2);
1010
}
1111
setValue(el, invoke, method);
12+
if (e.target.value.length === 1) {
13+
setNextFocus(el, e.target);
14+
}
1215
});
1316
EventHandler.on(el, 'keydown', '.bb-otp-item', e => {
1417
if (e.ctrlKey) {
@@ -95,7 +98,7 @@ const setFocus = target => {
9598
if (target.focus) {
9699
target.focus();
97100
}
98-
}, 10);
101+
}, 0);
99102
}
100103

101104
export function dispose(id) {

0 commit comments

Comments
 (0)