<el-button slot="append" icon="search" @click="handSearch" @keyup.enter="handSearch"></el-button>
methods: {
handSearch(){
this.items.splice(0, this.items.length);
this.$store.dispatch('findNewsPage', {key: this.input})
}
}
天蓬老师2017-05-19 10:23:48
First of all, the component does not have a built-in keyup event, so it should be @keyup.enter.native, but shouldn’t this event be written on the input component?
迷茫2017-05-19 10:23:48
The buttons and input of the element component are unresponsive, but ordinary input and buttons are ok.
黄舟2017-05-19 10:23:48
First go to the elementui documentation to see if there are custom events. If so, use the events provided by elementui.
If not, use the .native modifier to pass the event to the subcomponent
给组件绑定原生事件
有时候,你可能想在某个组件的根元素上监听一个原生事件。可以使用 .native 修饰 v-on 。例如:
<my-component v-on:click.native="doTheThing"></my-component>
vue binds native events to components