码迷,mamicode.com
首页 > 其他好文 > 详细

iview 表单验证

时间:2018-06-24 14:11:59      阅读:2499      评论:0      收藏:0      [点我收藏+]

标签:rip   idt   eva   取消   val   hold   class   tle   back   

<modal v-model="modelPassWord" width="520" title="修改密码"
		:mask-closable="false"> <i-form :label-width="100"
		ref=‘formItemP‘ :model="formItemP" :rules=‘ruleValidateP‘> <form-item
		label="请输入旧密码" prop="oldPwd"> <i-input
		placeholder="请输入旧密码" v-model="formItemP.oldPwd" name=""></i-input> </form-item> <form-item
		label="请输入新密码" prop="newPwd"> <i-input
		placeholder="请输入新密码" v-model="formItemP.newPwd"></i-input> </form-item> <form-item
		label="重新输入密码" prop="repeatPwd"> <i-input
		placeholder="重新输入密码" v-model="formItemP.repeatPwd"></i-input> </form-item> </i-form>
	<div slot="footer">
		<i-button type="ghost" @click="pwdModelCancel">取消</i-button>
		<i-button type="error" @click="pwdModelOk(‘formItemP‘)">确定</i-button>
	</div>
	</modal>

  

	//修改密码验证
			formItemP: {
				oldPwd: "",
				newPwd: "",
				repeatPwd: ""
			},
			ruleValidateP: {
				oldPwd: [{
					required: true,
					message: ‘请输入旧密码‘,
					trigger: ‘blur‘
				}],
				newPwd: [{
					required: true,
					message: ‘请输入新密码‘,
					trigger: ‘blur‘
				}],
				repeatPwd: [{
					required: true,
					trigger: ‘blur‘,
					validator:function(rule, value, callback){
	                    if (value == ‘‘) {
	                        return callback(new Error(‘请再次输入密码‘));
	                    } else if (value != logoApp.formItemP.newPwd) {
	                        return callback(new Error(‘两次密码不一致‘));
	                    } else {
	                        callback();
	                    }
	                }
				}]
			}

		}

  

iview 表单验证

标签:rip   idt   eva   取消   val   hold   class   tle   back   

原文地址:https://www.cnblogs.com/lgjc/p/9220318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!