#eleMent-ui 回车登录解决方法
直接上代码
在form表单设置默认的提交按钮后需要阻止表单默认提交事件,在表单上添加 @submit.native.prevent
@keyup.enter.native 是回车调用的方法
<template>
<div class="loginContain">
<div class="nav">
<router-link to = '' class="navItem active">登录</router-link>
<router-link to = "signUp" class="navItem">注册</router-link>
</div>
<div class="content_bx">
<el-form action="" :model="loginData" :rules="rules" ref="rulForm" label-width="0" @submit.native.prevent>
<el-form-item prop="phone">
<el-input class="input" autocomplete="off" v-model.number="loginData.phone" maxlength="11" placeholder="手机号" ></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input class="input" autocomplete="off" type="password" v-model="loginData.password" maxlength="16" placeholder="密码"></el-input>