Commit 5e47aa52 by 胡悦

登录添加回车事件

1 parent b16854a6
......@@ -42,6 +42,7 @@
<el-button
class="btn_login"
v-preventReClick
@keyup.enter="loginEvent(ruleFormRef)"
@click.prevent="loginEvent(ruleFormRef)"
>
登 录
......@@ -65,6 +66,12 @@ const loginForm = reactive({
acount: "",
password: "",
});
document.onkeydown = function (e) {
let key = (window as any).event.keyCode;
if (key === 13) {
loginEvent(ruleFormRef.value)
}
}
const validateAcount = (rule: any, value: any, callback: any) => {
let reg = new RegExp(
"[`~!@#$^&*=|{}':;./%',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
......@@ -86,6 +93,7 @@ const rules = reactive<FormRules>({
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
});
const loginEvent = async (formEl: FormInstance | undefined) => {
console.log(formEl);
if (!formEl) return;
await formEl.validate(async (valid) => {
if (valid) {
......@@ -133,6 +141,8 @@ const loginEvent = async (formEl: FormInstance | undefined) => {
}
});
};
</script>
<style scoped lang="scss">
.page {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!