Commit bb0d2e1c71899937f3c3d467803b18013e91782a
Committed by
GitHub
1 parent
5eee0ceb
fix(login): incorrect enter event bind (#625)
登录页面的回车事件绑定不正确,导致可能会意外提交登录表单:想按按下Enter关闭错误Modal时、在注册表单或其它表单按下Enter时等等。现已将Enter事件绑定在登录Form上
Showing
1 changed file
with
10 additions
and
3 deletions
src/views/sys/login/LoginForm.vue
1 | 1 | <template> |
2 | 2 | <LoginFormTitle v-show="getShow" class="enter-x" /> |
3 | - <Form class="p-4 enter-x" :model="formData" :rules="getFormRules" ref="formRef" v-show="getShow"> | |
3 | + <Form | |
4 | + class="p-4 enter-x" | |
5 | + :model="formData" | |
6 | + :rules="getFormRules" | |
7 | + ref="formRef" | |
8 | + v-show="getShow" | |
9 | + @keypress.enter="handleLogin" | |
10 | + > | |
4 | 11 | <FormItem name="account" class="enter-x"> |
5 | 12 | <Input size="large" v-model:value="formData.account" :placeholder="t('sys.login.userName')" /> |
6 | 13 | </FormItem> |
... | ... | @@ -88,7 +95,7 @@ |
88 | 95 | import { useUserStore } from '/@/store/modules/user'; |
89 | 96 | import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'; |
90 | 97 | import { useDesign } from '/@/hooks/web/useDesign'; |
91 | - import { onKeyStroke } from '@vueuse/core'; | |
98 | + //import { onKeyStroke } from '@vueuse/core'; | |
92 | 99 | |
93 | 100 | export default defineComponent({ |
94 | 101 | name: 'LoginForm', |
... | ... | @@ -129,7 +136,7 @@ |
129 | 136 | |
130 | 137 | const { validForm } = useFormValid(formRef); |
131 | 138 | |
132 | - onKeyStroke('Enter', handleLogin); | |
139 | + //onKeyStroke('Enter', handleLogin); | |
133 | 140 | |
134 | 141 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
135 | 142 | ... | ... |