如何監聽Element組件標籤的回車事件
一、現象
表單提交時需要處理輸入框的回車事件,一般的原生input標籤可以用@keyup.enter=“onSubmit”(tips:onSubmit爲定義的方法)
二、解決
1、@keyup.enter=“onSubmit” 改寫爲 @keyup.enter.native=“onSubmit” ,也就是說多加一個native標誌
2、如:
<el-input v-model="name" @keyup.enter.native="onSubmit" placeholder="User Name"></el-input>