Element form sheet method resetFields invalid

ResetFields invalid before the face of his or her own hand with this.ruleForm = Object.assign ({}, this.ruleForm , this. $ Options.data (). RuleForm) to clear the data in this way, with such a long form form, resetFields really take effect sometimes and sometimes not in force, then looked under the Element source, and finally found the mystery
source form-item when mounted is so written

mounted() {
      if (this.prop) {
        this.dispatch('ElForm', 'el.form.addField', [this]);

        let initialValue = this.fieldValue;
        if (Array.isArray(initialValue)) {
          initialValue = [].concat(initialValue);
        }
        Object.defineProperty(this, 'initialValue', {
          value: initialValue
        });

        this.addValidateEvents();
      }
    },

We can see the whole mounted operations are based on your definition of the prop can, then that is the definition of a initialValue initial value, and put in under this, and then execute resetFields when the value becomes the initial value, so the future appears to be necessary to prop Defined

Guess you like

Origin www.cnblogs.com/wzcsqaws/p/11493162.html