iview Form 组件阻止回车提交表单

版权声明:solo https://blog.csdn.net/sansan_7957/article/details/85324977

问题描述

form 中只有一个 input 时回车会自动提交表单,这是浏览器的默认行为。

解决办法

  • 第一种是在 Input 上加 @keydown.native.enter.prevent ="handleEnter"
  • 第二种是在 Form 上加 @submit.native.prevent

猜你喜欢

转载自blog.csdn.net/sansan_7957/article/details/85324977