mip-form form
mip-form is used to support form submission in mip.
Example
Basic usage
<mip-form method="post" url="//www.baidu.com"> <input type="input" name="username" validatetarget="username" validatetype="must" placeholder="姓名"> <div class="mip-form-target" target="username">姓名不能为空</div> <input type="input" name="email" validatetarget="email" validatetype="email" placeholder="邮件"> <div class="mip-form-target" target="email">填写正确的email</div> <input type="input" name="phone" validatetarget="phone" validatetype="phone" placeholder="电话"> <div class="mip-form-target" target="phone">填写正确的电话格式</div> <input type="input" name="customnumber" validatetarget="custom" validatetype="custom" validatereg=^[0-9]*$ placeholder="我是自定义验证规则数字"> <div class="mip-form-target" target="custom">请输入正确的数字</div> <input type="submit" value="提交"> </mip-form>
Add clear button
<mip-form method="post" url="//xxx" clear="true"> <input type="input" name="username" validatetarget="username" validatetype="must" placeholder="姓名"> <div target="username">姓名不能为空</div> <input type="input" name="email" validatetarget="email" validatetype="email" placeholder="邮件"> <div target="email">填写正确的email</div> <input type="submit" value="提交"> </mip-form>
Attributes
method
Description: Form submission method
Required option: Yes
url
Description: The form submission url is equivalent to the action of the form, requiring https://
or //
starts with
Required option: Yes
validatetarget
Description: The validation prompt corresponds to the tag, which is used to display the element when the error occurs. Find
Required options: No
validatetype
Description: Validation type, used to support simple verification. Currently, email, phone, idcar, and custom are provided. When it is custom, you need to fill in validatereg
Required options: No
validatereg
Description: Customize verification to supplement the webmaster's personalized verification rules. If validatetype is custom, you need to fill in the corresponding validation rules
Required option: No
clear
Description: The input clear button switch in the form
Required option: No