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.48k stars 1.49k forks source link

[Feature Request] How to disabled initialValues in readPretty mode #3929

Closed skyfore closed 1 year ago

skyfore commented 1 year ago

What problem does this feature solve?

请问如何在 readPretty 模式下禁止 initialValues 的生效,包括 schema 中的 default 定义以及 x-reaction 中触发的 setState({ initialValue }) 等等,在我们这边很多的场景定义中阅读态要求后端数据怎样就怎样,不用前端的默认值逻辑生效

What does the proposed API look like?

createForm({ disabledinitialValue: true })

janryWang commented 1 year ago

本身 initialValues 就可以覆盖 schema 中定义的默认值,你只需要在实例化 form 之后,手动 调用 setInitialValues