我创建了搜索栏,当我按 Enter 时,然后将请求发送到服务器。
HTML 文件:
<v-text-field
outlined
dense
label="Search..."
append-icon="mdi-magnify"
@keydown.enter="searchEvent($event.target.value)"
></v-text-field>
.TS文件:
methods: {
...mapActions('event', ['searchEvent']),
searchEvent(value: string){
this.searchEvent(value)
}
VUEX文件:
searchEvent({ commit}, value) {
console.log(value)
EventApi.search(value)
.then( result => {
commit('searchEvents', result.data)
})
.catch( error => {
console.error("Error: ", {error:error});
})
},
犯罪嫌疑人X
相关分类