跳转至

Ant Design form表单—重置方法不生效

必填项

原因

重置表单:需要给每一项添加prop,才能生效

<a-form-model
    ref="ruleForm"
    :model="form"
    :rules="rules"
    :label-col="labelCol"
    :wrapper-col="wrapperCol"
  >
    <a-form-model-item label="Activity name" prop="name">
      <a-input
        v-model="form.name"
      />
    </a-form-model-item>
      <a-form-model-item label="Activity password" prop="password">
      <a-input
        v-model="form.password"
      />
    </a-form-model-item>
  </a-form-model>
resetForm() {
  this.$refs.ruleForm.resetFields();
},