Problem Description
Use the input component of elementui in vue to bind the carriage return event to take effect.
<el-input
@keyup.enter='方法'
></el-input>
problem causes
v-on或@
If you use the listening event directly in vue , what you listen to is 由组件中使用$emit自定义的事件
, for example, the following code.
子组件
...
this.$emit('test')
...
父组件
...
<子组件标签 @test='方法'/>
...
Solution
Use modifiers to tell vue whether .native
this is triggered , such as the following listener .原生事件
自定义事件
element-ui的输入框回车事件
<el-input
@keyup.enter.native='方法'
></el-input>