WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2022-08-11 38da567056a6fb2c2287523ccc472c9775904495
forms/form/CFormItem.vue
@@ -100,31 +100,29 @@
    },
    mounted() {
        this.$nextTick(() => {
            // 未设置验证
            if (!this.required && !this.rules) {
                this.formRes.$regItemValidator(this.name, validateType => {
            let errTimer = null;
            // 注册验证
            this.formRes.$regItemValidator(this.name, validateType => {
                // 未设置验证
                if (!this.required && !this.rules) {
                    this.error = false;
                    return Promise.resolve({
                        name: this.name,
                        passed: true,
                    });
                });
            } else {
                // 验证规则
                const descriptor = this.rules || [];
                if (this.required) {
                    descriptor.unshift({
                        required: true,
                } else {
                    // 验证规则
                    const descriptor = this.rules || [];
                    if (this.required) {
                        descriptor.unshift({
                            required: true,
                        });
                    }
                    const validator = new Schema({
                        [this.name]: descriptor,
                    });
                }
                const validator = new Schema({
                    [this.name]: descriptor,
                });
                // 汉化通用验证消息
                validator.messages(validateMsgs);
                // 注册验证
                let errTimer = null;
                this.formRes.$regItemValidator(this.name, validateType => {
                    // 汉化通用验证消息
                    validator.messages(validateMsgs);
                    return validator
                        .validate({
                            [this.name]: this.formRes.formData[this.name],
@@ -155,8 +153,8 @@
                                };
                            }
                        );
                });
            }
                }
            });
        });
    },
    beforeDestroy() {