關(guān)于VUE 中 form 表單中button和表單提交問題
>將form其中一個button類型設(shè)為 submit 可使表單執(zhí)行提交動作,從而讓諸如“required”之類的驗(yàn)證起作用。??
>將表單的submit事件加上 .prevent 可來阻止表單執(zhí)行默認(rèn)動作(不會刷新頁面,不會向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.
標(biāo)簽: