問題原因:參考element-ui文檔: W3C 標準中有如下規定: When there is only one single-line text input field in a form, the user agent should accept Enter in that field as ...
問題原因:
參考element-ui文檔:
W3C 標準中有如下規定:
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.
即:當一個 form 元素中只有一個輸入框時,在該輸入框中按下回車應提交該表單。如果希望阻止這一預設行為,可以在 <el-form>
標簽上添加 @submit.native.prevent
。
解決方法:
<el-form @submit.native.prevent></el-form>