We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4528e54 commit 4c97e34Copy full SHA for 4c97e34
@sensoro-design/react/src/pin-code/index.tsx
@@ -92,13 +92,23 @@ const PinCode = forwardRef<PinCodeRefs, PinCodeProps>(
92
93
const code = evt.keyCode || evt.which;
94
const { tagName, id } = document.activeElement ?? {};
95
+
96
if ([37, 39].includes(code)) {
97
const operate = code === 37 ? -1 : 1;
98
const index = tagName === 'INPUT' ? Number(id) + operate : 0;
99
if (index >= 0 && index < count) {
100
inputs[index].focus();
101
}
102
103
104
+ // 删除
105
+ if (code === 8 && tagName === 'INPUT') {
106
+ setTimeout(() => {
107
+ if (Number(id) > 0) {
108
+ inputs[Number(id) - 1].focus();
109
+ }
110
+ }, 0);
111
112
};
113
114
document.addEventListener('keydown', onKeyDown);
0 commit comments