Vue uses the elementUI form to appear in the input box form and press Enter to refresh the page

There is a bug in the project today, the elementUI form is used in the vue project, and the content of the input box is cleared after the input box form is entered.
It suddenly occurred to me that when I took students to write a project before, there was only one input box in the conditional filter box at the head of the list page, and the page would be refreshed by pressing Enter. At this time, the input box was placed in a label form. If you put it in one div, there fromwill be no problem of refreshing the page by pressing Enter in the input box.
After querying the data, it is found that when there formis only one input box in a form, the carriage return in the input box triggers the submit submitevent of the form by default.
Solution: prevent form submit event

<el-form @submit.native.prevent="" >

Guess you like

Origin blog.csdn.net/weixin_44801790/article/details/129745907