Skip to content

Commit

Permalink
login fix
Browse files Browse the repository at this point in the history
  • Loading branch information
syzygy608 committed Aug 30, 2024
1 parent 8c5bf87 commit e454496
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/pages/login/loginarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="w-10/12 md:w-5/12 bg-gray-100 rounded-3xl shadow-lg mx-auto py-16">
<div class="text-center text-2xl font-bold">後台登入</div>
<hr class="w-10/12 mx-auto mt-3" />
<form class="text-center py-6" >
<form class="text-center py-6">
<div>
<label for="code" class="block text-lg">請輸入驗證碼</label>
<input
Expand All @@ -18,11 +18,11 @@
inputmode="numeric"
required
v-model="inputs[index]"
@input="focusNext($event, index)"
/>
@input="focusNext($event, index)" />
</div>
<button
type="button" @click="handleSubmit"
type="button"
@click="handleSubmit"
class="mt-3 bg-orange-200 py-2 px-10 rounded-2xl hover:bg-orange-300">
登入
</button>
Expand All @@ -37,10 +37,13 @@ const env = import.meta.env;
import Token from "../../../functions/token.ts";
import { ref } from "vue";
const inputs = ref(Array(6).fill(''));
const inputs = ref(Array(6).fill(""));
// 定義一個方法來自動聚焦到下一個輸入框
const focusNext = (event, index) => {
if (event.target.value.length === 1 && index < inputs.value.length - 1) {
if (
event.target.value.length === 1 &&
index < inputs.value.length - 1
) {
event.target.nextElementSibling.focus();
}
};
Expand Down

0 comments on commit e454496

Please sign in to comment.