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

Why is this form submit handler not working?
FranzSkuffka picture FranzSkuffka  ·  3Comments

怎样覆盖原有样式
chao-hua picture chao-hua  ·  3Comments

请问有计划增加contextmenu组件吗?
dbskccc picture dbskccc  ·  3Comments

建议每个release版本除了源码同时给出编译好的.css和.js文件
Zhao-github picture Zhao-github  ·  3Comments

建议增加collapse组件。
akaylh picture akaylh  ·  3Comments