mirror of https://github.com/ElemeFE/element
commit
3d18463415
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
*2016-XX-XX*
|
*2016-XX-XX*
|
||||||
|
|
||||||
|
- 修复 Form reset method 对日期控件不起效的问题
|
||||||
|
|
||||||
#### 非兼容性更新
|
#### 非兼容性更新
|
||||||
|
|
||||||
- 全屏 Loading 现在默认不再锁定屏幕滚动。如果需要的话,可添加 `lock` 修饰符
|
- 全屏 Loading 现在默认不再锁定屏幕滚动。如果需要的话,可添加 `lock` 修饰符
|
||||||
|
|
|
@ -78,7 +78,8 @@
|
||||||
validateDisabled: false,
|
validateDisabled: false,
|
||||||
validating: false,
|
validating: false,
|
||||||
validator: {},
|
validator: {},
|
||||||
isRequired: false
|
isRequired: false,
|
||||||
|
initialValue: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -118,12 +119,9 @@
|
||||||
if (Array.isArray(value) && value.length > 0) {
|
if (Array.isArray(value) && value.length > 0) {
|
||||||
this.validateDisabled = true;
|
this.validateDisabled = true;
|
||||||
model[this.prop] = [];
|
model[this.prop] = [];
|
||||||
} else if (typeof value === 'string' && value !== '') {
|
} else if (value) {
|
||||||
this.validateDisabled = true;
|
this.validateDisabled = true;
|
||||||
model[this.prop] = '';
|
model[this.prop] = this.initialValue;
|
||||||
} else if (typeof value === 'number') {
|
|
||||||
this.validateDisabled = true;
|
|
||||||
model[this.prop] = 0;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRules() {
|
getRules() {
|
||||||
|
@ -151,12 +149,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.validate('change');
|
this.validate('change');
|
||||||
|
},
|
||||||
|
getInitialValue() {
|
||||||
|
var value = this.form.model[this.prop];
|
||||||
|
if (value === undefined) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return JSON.parse(JSON.stringify(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.prop) {
|
if (this.prop) {
|
||||||
this.dispatch('form', 'el.form.addField', [this]);
|
this.dispatch('form', 'el.form.addField', [this]);
|
||||||
|
|
||||||
|
this.initialValue = this.getInitialValue();
|
||||||
|
|
||||||
let rules = this.getRules();
|
let rules = this.getRules();
|
||||||
|
|
||||||
if (rules.length) {
|
if (rules.length) {
|
||||||
|
|
Loading…
Reference in New Issue