xaboy / form-create

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

FormCreate放到 a-modal 弹框中时,resetFields 无效 #697

Closed zaxlct closed 5 months ago

zaxlct commented 5 months ago

FormCreate放到 modal 弹框中时,resetFields 无效 "ant-design-vue": "^4.1.2" "@form-create/ant-design-vue": "^3.1.28"

<a-modal
  v-model:open="open"
>
  <FormCreate
    v-model:api="fApi"
    v-model="value"
    :option="formCreateOptions"
    :rule="rule"
  >
  </FormCreate>

  <a-button @click="reset">reset</a-button>
</a-modal>

function reset() {
  fApi.value.resetFields() // 没有效果
}

把 a-modal 拿掉,就正常了


  <FormCreate
    v-model:api="fApi"
    v-model="value"
    :option="formCreateOptions"
    :rule="rule"
  >
  </FormCreate>

  <a-button @click="reset">reset</a-button>

function reset() {
  fApi.value.resetFields() // 正常
}
wojss commented 4 months ago

@zaxlct 请问,这个问题解决了吗,怎么处理的呢

FormCreate放到 modal 弹框中时,resetFields 无效 "ant-design-vue": "^4.1.2" "@form-create/ant-design-vue": "^3.1.28"

<a-modal
  v-model:open="open"
>
  <FormCreate
    v-model:api="fApi"
    v-model="value"
    :option="formCreateOptions"
    :rule="rule"
  >
  </FormCreate>

  <a-button @click="reset">reset</a-button>
</a-modal>

function reset() {
  fApi.value.resetFields() // 没有效果
}

把 a-modal 拿掉,就正常了


  <FormCreate
    v-model:api="fApi"
    v-model="value"
    :option="formCreateOptions"
    :rule="rule"
  >
  </FormCreate>

  <a-button @click="reset">reset</a-button>

function reset() {
  fApi.value.resetFields() // 正常
}