Skip to content

Commit c33c3a2

Browse files
committed
refactor: 增加过滤条件
1 parent 03c5928 commit c33c3a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
export function init(id) {
44
const el = document.getElementById(id);
55
const skipKeys = ['Enter', 'Tab', 'Shift', 'Control', 'Alt'];
6-
EventHandler.on(el, 'input', 'input', e => {
6+
EventHandler.on(el, 'input', '.bb-opt-item', e => {
77
const isNumber = e.target.getAttribute('type') === 'number';
88
if (isNumber) {
99
if (e.target.value.length > 1) {
1010
e.target.value = e.target.value.slice(1, 2);
1111
}
1212
}
1313
});
14-
EventHandler.on(el, 'keydown', 'input', e => {
14+
EventHandler.on(el, 'keydown', '.bb-opt-item', e => {
1515
const isNumber = e.target.getAttribute('type') === 'number';
1616
if (skipKeys.indexOf(e.key) > -1) {
1717

@@ -37,7 +37,7 @@ export function init(id) {
3737
e.preventDefault();
3838
}
3939
});
40-
EventHandler.on(el, 'focus', 'input', e => {
40+
EventHandler.on(el, 'focus', '.bb-opt-item', e => {
4141
if (e.target.select) {
4242
e.target.select();
4343
}

0 commit comments

Comments
 (0)