因为element-ui 对input做了封装,使用@keyup.enter="fn"触发Enter键事件就不会触发,解决:后面追加.native。@keyup.enter.native="submitForm" 即可解决。
<el-form-item prop="password">
<el-input type="password" v-model="password" @keyup.enter.native="submitForm" placeholder="请输入密码" >
<el-button slot="prepend" icon="el-icon-lx-lock"></el-button>
</el-input>
</el-form-item>
看自,有检验自:https://blog.csdn.net/adley_app/article/details/84376119