el-input回车刷新页面

447 阅读1分钟

问题原因:W3C有如下规定,当一个 form 元素中只有一个输入框时,在该输入框中按下回车应提交该表单。

1637306203(1).jpg 解决方法:

<el-form @submit.native.prevent></el-form>

用JSX写法:

<el-form
    nativeOnSubmit={(event:any) => event.preventDefault()}
    props={props}
    inline={true}
>
</el-form>