mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-02 12:18:46 +08:00
commit
ceed04d3a2
@ -514,7 +514,7 @@
|
||||
<el-option label="区域二" value="beijing"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动时间">
|
||||
<el-form-item label="活动时间" required>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="date1">
|
||||
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 100%;"></el-date-picker>
|
||||
|
@ -127,9 +127,12 @@
|
||||
}
|
||||
},
|
||||
getRules() {
|
||||
if (!this.prop) { return []; }
|
||||
var rules = this.rules || (this.form.rules ? this.form.rules[this.prop] : []);
|
||||
return Array.isArray(rules) ? rules : [rules];
|
||||
var formRules = this.form.rules;
|
||||
var selfRuels = this.rules;
|
||||
|
||||
formRules = formRules ? formRules[this.prop] : [];
|
||||
|
||||
return [].concat(selfRuels || formRules || []);
|
||||
},
|
||||
getFilteredRule(trigger) {
|
||||
var rules = this.getRules();
|
||||
@ -151,21 +154,22 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var rules = this.getRules();
|
||||
|
||||
rules.every(rule => {
|
||||
if (rule.required) {
|
||||
this.isRequired = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.prop) {
|
||||
this.dispatch('form', 'el.form.addField', [this]);
|
||||
}
|
||||
|
||||
this.$on('el.form.blur', this.onFieldBlur);
|
||||
this.$on('el.form.change', this.onFieldChange);
|
||||
let rules = this.getRules();
|
||||
|
||||
if (rules.length) {
|
||||
rules.every(rule => {
|
||||
if (rule.required) {
|
||||
this.isRequired = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.$on('el.form.blur', this.onFieldBlur);
|
||||
this.$on('el.form.change', this.onFieldChange);
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.dispatch('form', 'el.form.removeField', [this]);
|
||||
|
Loading…
Reference in New Issue
Block a user