ElementUI / babel-plugin-component

Modular element-ui build plugin for babel.
452 stars 96 forks source link

更新wp4后, 构造器被转码导致报错 #37

Closed Glenfiddish closed 6 years ago

Glenfiddish commented 6 years ago

Error in event handler for "el.form.blur": "TypeError: _asyncValidator2.default is not a constructor"

`methods: { validate: function validate(trigger) { var _this = this;

  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _util.noop;

  this.validateDisabled = false;
  var rules = this.getFilteredRule(trigger);
  if ((!rules || rules.length === 0) && this.required === undefined) {
    callback();
    return true;
  }

  this.validateState = 'validating';

  var descriptor = {};
  if (rules && rules.length > 0) {
    rules.forEach(function (rule) {
      delete rule.trigger;
    });
  }
  descriptor[this.prop] = rules;

  var validator = new _asyncValidator2.default(descriptor);
  var model = {};

  model[this.prop] = this.fieldValue;

  validator.validate(model, { firstFields: true }, function (errors, invalidFields) {
    _this.validateState = !errors ? 'success' : 'error';
    _this.validateMessage = errors ? errors[0].message : '';

    callback(_this.validateMessage, invalidFields);
    _this.elForm && _this.elForm.$emit('validate', _this.prop, !errors);
  });
},
clearValidate: function clearValidate() {
  this.validateState = '';
  this.validateMessage = '';
  this.validateDisabled = false;
},`

var validator = new _asyncValidator2.default(descriptor); 这句的转码有问题.