vue–enter enter to refresh the page problem

Hits: 0

Problem Description:

When the input is over, press the enter key, the page refreshes, do not want to refresh

problem analysis:

When there is only one input box in the [form] , pressing the Enter key will cause the form to be submitted and the page will be refreshed

solution:

Adding on the form is provided on the Internet and @submit.native.preventfound that it is prone to unpredictable problems.
Finally found:
adding an event on the input element to prevent the default form submit

onkeypress="if(event.keyCode == 13) return false;"

Leave a Reply

Your email address will not be published.