- 为el-form表单添加:rules
- 在data中定义规则
- 将定义的规则绑定在el-form-item
代码如下:
登录 重置
PS:下面看下vue 自定义指令input表单的数据验证的代码
一、代码
{{msg}}
{{msg1}}
{{msg2}}
{{msg3}}
.input {
padding-bottom: 20px;
float: left;
clear: both;
margin-left: 500px;
display: block;
}
.check input {
width: 300px;
height: 35px;
outline: none;
background: #ddd;
}
.check span {
padding-left: 20px;
}
.tipsDiv {
height: 27px;
line-height: 25px;
border: 1px solid #333;
background: #333;
padding: 0px 5px;
border-radius: 4px;
color: #fff;
font-size: 16px;
}
.tipsDiv:before {
content: '';
display: block;
border-width: 0 5px 8px;
border-style: solid;
border-color: transparent transparent #000;
position: absolute;
top: -9px;
left: 6px;
}
总结
到此这篇关于vue实现表单数据验证的实例代码的文章就介绍到这了,更多相关vue 表单数据验证内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!



