欢迎光临散文网 会员登陆 & 注册

关于VUE 中 form 表单中button和表单提交问题

2023-02-10 12:50 作者:Tuple_元组  | 我要投稿

>将form其中一个button类型设为 submit 可使表单执行提交动作,从而让诸如“required”之类的验证起作用。  

>将表单的submit事件加上 .prevent 可来阻止表单执行默认动作(不会刷新页面,不会向action指定的地址提交)。

>(property) ButtonHTMLAttributes.type?: "button" | "submit" | "reset" | undefined

The type of the button. Possible values are:

>submit: The button submits the form data to the server. *This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.*

reset: The button resets all the controls to their initial values.

>button: The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur.


关于VUE 中 form 表单中button和表单提交问题的评论 (共 条)

分享到微博请遵守国家法律