| | |
| | | label: this.label, |
| | | required: this.isRequired, |
| | | error: this.error, |
| | | onChange: (evt) => this.onChange(evt), |
| | | onChange: evt => this.onChange(evt), |
| | | }; |
| | | }, |
| | | isRequired() { |
| | |
| | | !hasOwn.call(evt, 'constructor') && |
| | | !hasOwn.call(evt.constructor.prototype, 'isPrototypeOf') |
| | | ) { |
| | | throw new Error('错误的表单项 onChange 参数类型!(At: ' + this.name + ')'); |
| | | return; |
| | | throw new Error( |
| | | '错误的表单项 onChange 参数类型!(At: ' + this.name + ')' |
| | | ); |
| | | } |
| | | } |
| | | // 未改变值不触发 |
| | |
| | | this.$nextTick(() => { |
| | | // 未设置验证 |
| | | if (!this.required && !this.rules) { |
| | | this.formRes.$regItemValidator(this.name, (validateType) => { |
| | | this.formRes.$regItemValidator(this.name, validateType => { |
| | | this.error = false; |
| | | return Promise.resolve({ |
| | | name: this.name, |
| | |
| | | validator.messages(validateMsgs); |
| | | // 注册验证 |
| | | let errTimer = null; |
| | | this.formRes.$regItemValidator(this.name, (validateType) => { |
| | | this.formRes.$regItemValidator(this.name, validateType => { |
| | | return validator |
| | | .validate({ |
| | | [this.name]: this.formRes.formData[this.name], |
| | | }) |
| | | .then( |
| | | (res) => { |
| | | res => { |
| | | this.error = false; |
| | | return { |
| | | name: this.name, |