因為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
