x-render
x-render copied to clipboard
removeHiddenData已经设置为false,表单的提交数据还是没有hidden字段的默认值
1.依赖仓库的版本(Dependencies versions):
- react:16.9.0
- form-render:2.3.8
- antd:5.12.8
2.问题描述(Bug description): removeHiddenData已经设置为false,但表单的提交数据还是没有hidden字段的默认值(default),试过使用form.getValues(true)和form.getHiddenValues(),也拿不到hidden的默认值(default),详见下方demo。 举例的schema中 type字段的hidden为true,default值为4,但在表单提交的时候只有schema中source字段的值
3.出现问题的 schema demo(Reproduction schema demo):
const schema = {
type: "object",
properties: {
arg1: {
description: "",
title: "arg1",
type: "object",
properties: {
type: {
default: "4",
description: "",
title: "type",
type: "string",
hidden: true,
},
source: {
default: "test",
description: "",
title: "source",
type: "string",
},
},
required: [],
},
},
required: [],
}
4.最小复现 demo(Reproduction demo):
https://codesandbox.io/p/sandbox/trusting-panka-forked-hj8q4p?file=%2Fsrc%2FApp.js
确实,你这种比较极端。default 根本就没有被写入 form 表单里面,如果是一开始显示,后面隐藏。或者是通过 setValues 被赋过初始值就不会出现这个问题,直接 hidden,还有搜集 default 这确实,怎么说呢