javascript - Use vue.js to monitor the enter event, but there is no response at all
高洛峰
高洛峰 2017-05-19 10:21:48
0
3
622
<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})
            }
        }
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Peter_Zhu

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?

迷茫

The buttons and input of the element component are unresponsive, but ordinary input and buttons are ok.

黄舟

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template