Element Plus 的 Button 按钮怎么加 type 为 submit?

534 阅读1分钟

我在使用 Element Plus - Form 的时候,不想在 Form 表单里的提交按钮上添加 @click,通过点击事件来请求接口。

而是想使用 type 为 submit 类型的按钮,请求接口的事件写在 Form 里。

通过查看官方文档,发现只要在 el-button 上加 native-type 就可以了

 <el-button native-type="submit">提交</el-button>

Element Plus - Button Attributes