Skip to content

Commit

Permalink
feat: login add keyboard event
Browse files Browse the repository at this point in the history
  • Loading branch information
flingyp committed Sep 30, 2023
1 parent fca30b8 commit 3eab077
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/views/auth/components/SystemLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ const getSignInAuth = async () => {
setLoading(false)
}, 1000)
}
const keyboardLoginEvent = async (event: KeyboardEvent) => {
if (event.key === 'Enter') await getSignInAuth()
}
onMounted(() => {
window.addEventListener('keydown', keyboardLoginEvent)
})
onUnmounted(() => {
window.removeEventListener('keydown', keyboardLoginEvent)
})
// eslint-disable-next-line no-unused-vars
const switchSign = inject('switchSign') as (value: boolean) => void
Expand Down Expand Up @@ -93,7 +102,7 @@ const switchSign = inject('switchSign') as (value: boolean) => void
block
type="primary"
:loading="isSignInLoading"
@click="getSignInAuth"
@click.enter="getSignInAuth"
>
<template #icon>
<icon-mdi:shield-lock-outline />
Expand Down

0 comments on commit 3eab077

Please sign in to comment.