xaboy / form-create

:fire::fire::fire: 强大的低代码动态表单组件,通过数据驱动表单渲染,适配移动端,支持可视化设计。提高开发者对表单的开发效率。目前在政务系统、OA系统、ERP系统、电商系统、流程管理等系统中已稳定应用。
https://www.form-create.com/
MIT License
5.97k stars 960 forks source link

手动提交的问题,验证的问题 #703

Closed yangyaq closed 3 months ago

yangyaq commented 3 months ago

版本号: "@form-create/element-ui": "2.5.29", UI 框架的版本 (UI version) : 2.15.10

  1. 在外部组件中 调用nextStep()方法

  2. nextStep() 内部手动调用 submit 在数据为空的情况下得到的结果是 校验通过, 但是 表单上提示了相应信息,如图 image

<template>
  <div>
    <form-create v-model="fApi" :rule="rule"  :option="options" :value.sync="value"
    />
    <div>
    </div>
  </div>
</template>

<script>

export default {
  name: "tmpFile",
  created() {
  },
  data(){
    return {
      fApi: {},
      rule: [
        {
          "type": "input",
          "field": "d_remark",
          "title": "变更描述",
          "info": "",
          "_fc_drag_tag": "input",
          "hidden": false,
          "display": true,
          "validate": [{"required": true, "trigger": "blur", "min": 1}],
          // "$required": ""
        },
      ],
      options:{
        "onSubmit": (formData) => {
          this.$emit('reportFileValue', formData)
        },
        "form": {
          "labelPosition": "left",
          "size": "mini",
          // "labelWidth": "150px",
          "hideRequiredAsterisk": false,
          "showMessage": true,
          "inlineMessage": false
        },
        "submitBtn": false,
      },
      value: {},
      fileNameOptions: []
    }
  },
  methods: {
    nextStep(){
      // this.fApi.submit(() => alert('success'))
      this.fApi.submit((formData, fapi) => {
        //todo 提交表单
        alert("通过")
        console.log("表单验证通过", fapi, formData)
      },()=>{
        alert("失败")
        console.log("表单验证未通过")
        //todo 表单验证未通过
      })
    }
  }
}
</script>

期望:能在数据 不合法不满足必填验证时,结果是未校验通过

xaboy commented 3 months ago

感谢反馈,我这边检查一下 @yangyaq

xaboy commented 3 months ago

没有复现,我这边测试在不输入的情况下,弹窗的是"失败" @yangyaq

yangyaq commented 3 months ago

能看下你的用法吗,参考一下

xaboy commented 3 months ago
image

ElementUI版本是2.15.9 formCreate是最新版

yangyaq commented 3 months ago

vue 2 可用的 formCreate最新版本是多少啊

xaboy commented 3 months ago

v2.5.35版本

yangyaq commented 3 months ago

用这个版本正常了,感谢!