As shown in the figure, the element-ui enter submission binding is invalid. How to solve the problem?


as shown in the figure, I give el-form a return submission to execute a method, and @ keyup.enter.native is written on el-form. I"ve used element-ui before. It"s written on el-form. I saw that people who looked up on the Internet also said @ keyup.enter.native would be fine. It doesn"t work to write here or el-input or el-button this time. Enter always refreshes the page, just like a normal form submission.
has anyone encountered it and how to solve it?


should be the refresh of the page caused by the native submit of form. Return false is to avoid executing form native submit


the W3C standard has the following provisions:

When there is only one single-line text input field in a form, the user agent should accept Enter in that field as a request to submit the form.

that is, when has only one input box in a form element , pressing enter in that input box should submit the form. If you want to prevent this default behavior, you can add @ submit.native.prevent to the < el-form > tag.

Menu