| | |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | let errTimer = null; |
| | | // 注册验证 |
| | | this.formRes.$regItemValidator(this.name, validateType => { |
| | | // 未设置验证 |
| | | if (!this.required && !this.rules) { |
| | | this.formRes.$regItemValidator(this.name, validateType => { |
| | | this.error = false; |
| | | return Promise.resolve({ |
| | | name: this.name, |
| | | passed: true, |
| | | }); |
| | | }); |
| | | } else { |
| | | // 验证规则 |
| | |
| | | }); |
| | | // 汉化通用验证消息 |
| | | validator.messages(validateMsgs); |
| | | // 注册验证 |
| | | let errTimer = null; |
| | | this.formRes.$regItemValidator(this.name, validateType => { |
| | | return validator |
| | | .validate({ |
| | | [this.name]: this.formRes.formData[this.name], |
| | |
| | | }; |
| | | } |
| | | ); |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | beforeDestroy() { |
| | | this.formRes.$regItemValidator(this.name, null); |