From 7cf53acd18e6889ad286ffef42d76853a65c8b9c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 2 Jul 2023 23:38:15 +0800 Subject: [PATCH] auto focus pin code input when open desktop unlock page --- src/components/common/PinCodeInput.vue | 2 ++ src/views/desktop/UnlockPage.vue | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/common/PinCodeInput.vue b/src/components/common/PinCodeInput.vue index 35fb9320..3c92d81e 100644 --- a/src/components/common/PinCodeInput.vue +++ b/src/components/common/PinCodeInput.vue @@ -7,6 +7,7 @@ :ref="`pin-code-input-${index}`" :value="codes[index].value" :type="codes[index].inputType" + :autofocus="autofocus && index === 0 ? 'autofocus' : undefined" @focus="codes[index].focused = true" @blur="codes[index].focused = false" @keydown="onKeydown(index, $event)" @@ -21,6 +22,7 @@ export default { props: [ 'modelValue', + 'autofocus', 'secure', 'length' ], diff --git a/src/views/desktop/UnlockPage.vue b/src/views/desktop/UnlockPage.vue index 1f8027c4..160fe9c6 100644 --- a/src/views/desktop/UnlockPage.vue +++ b/src/views/desktop/UnlockPage.vue @@ -19,7 +19,8 @@ - +