alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
11.46k stars 1.49k forks source link

自定义组件,删除后表单值没有正常回显 #630

Closed sunny20131314 closed 4 years ago

sunny20131314 commented 4 years ago

Help us to manage our issues by answering the following:

  1. How would you tag this issue?

    • Bug
  2. Describe your issue:

    • What is the current behavior? 目前大概需求是:封装一个组件,这个组件支持删除,编辑,新增功能。 组件渲染的总体结构是确定的,但是支持动态渲染(有个选择弹框,选择的组件才渲染)

由于组件中每组要渲染的结构是不定的,很有可能会不一样,所以就决定把每组要渲染的结构放在state中保存 在这种情况下,删除时就需要把某项的值和对应的schema删除,然而删除后表单值没有正常回显

  1. If your issue is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via Bug Report Template on CodeSandbox .

https://codesandbox.io/s/uformdeleteerror-4mw11

janryWang commented 4 years ago

image 遍历过程需要指定key,否则删除的时候内部组件无法正常unmount

sunny20131314 commented 4 years ago

感谢回复; 我这边试了试,添加了6组并随便赋值后,随意删除2组后,值显示正常,但是继续删除,剩余的3组的值并没有正常回显,烦请指导,谢谢

sunny20131314 commented 4 years ago

这个问题我已解决,谢谢 解决如下:移除值放在CustomForm组件内部处理