vue使用element-ui 監聽使用回車鍵事件


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM