今天想使用鍵盤事件回車直接搜索,發現在<el-input>中的@keyup.enter不起作用,需要修改一下寫法,改產@keyup.enter.native:
<el-input v-model="stitle" @keyup.enter.native="search" placeholder="請輸入標題" style="width: 300px;"></el-input>
而在<input>中直接使用就行:<input v-model="stitle" @keyup.enter="search" placeholder="請輸入標題" style="width: 300px;" />