Element: el-input如何响应v-on:keyup.enter

Created on 11 Jan 2017  ·  12Comments  ·  Source: ElemeFE/element

vue支持如下写法
但在
Source

Most helpful comment

@keyup.enter.native

All 12 comments

@keyup.enter.native

@baiyaaaaa
Cool! This works for me!

@baiyaaaaa 这个在文档的什么地方写的有? 我没找到, 谢谢

the better way to support enter to submit a form is set native-type='submit' on el-button component.

Muito bom isso funciona pra mim. valeu Galera! Viva a comunidade...
<el-input :placeholder="'Comente sobre isso...'" v-model="message" @keyup.enter.native="saveComment"></el-input>

in version 2.5.7 @keyup.enter="search" work

    <el-input placeholder="请输入内容" v-model="input" clearable size="small" @keyup.enter.native="handleClick">
    </el-input>

Just like this,it's right!!!

@baiyaaaaa 这个在文档的什么地方写的有? 我没找到, 谢谢
Vue官方文档_从 Vue 1.x 迁移_用 v-on 监听原生事件 变更

I write @keyup.native.enter, however, it doesn't work as submit button did, it refreshes the whole page and didn't create any post request.

你可以使用 @keypress.enter.native="submitForm('resetPasswordForm')" . Ref: https://polinwei.com/element-ui-prevent-form-submit/

I write @keyup.native.enter, however, it doesn't work as submit button did, it refreshes the whole page and didn't create any post request.

you made a mistake.It shoule be @keyup.enter.native

@keyup.enter.native

in JSX

{...{
nativeOn: {
keyup: (e) => {
if (e.keyCode === 13) {}
}
}
}}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

希望支持 webpack2 的 tree-shaking
smallpath picture smallpath  ·  3Comments

el-menu导航动态绑定,会报错
no5no6 picture no5no6  ·  3Comments

input 是否支持回车
yubo111 picture yubo111  ·  3Comments

table组件中使用row-click,三个参数为何都是undefined
makunsusu picture makunsusu  ·  3Comments

el-col 嵌套<el-form-item>时,<el-form-item>不可编辑
zhguokai picture zhguokai  ·  3Comments