ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🧐[问题] Schema Form的valueType:formList,renderFormItem失效 #8450

Open regretNow opened 5 months ago

regretNow commented 5 months ago

🧐 问题描述

我在Schema Form的使用valueType:formList,在renderFormItem想要用defaultRender,修改“新增一行”的功能,但使用formList,但renderFormItem直接无法使用了。但其他简单的valueType格式就可以使用

💻 示例代码

{ title: field.fieldName + "<" + field.fieldKey + ">", dataIndex: field.fieldKey, valueType: 'formList',

      columns: [
        {
          valueType: 'group',
          columns: childrenColumns,
        },
        {
          dataIndex: 'batchNo',
          hideInForm: true
        },
      ],
      fieldProps: (form, config) => {
        return {
          creatorButtonProps: showIsSource ? false : {creatorButtonText: `新建一行${field.fieldName}`},
          copyIconProps: false,
        }
      },
      renderFormItem: (schema, config, form) => {
        console.log(schema)
        console.log(config)
        console.log(form)
        return <>
          {config.defaultRender()}
          <Form.Item>
            <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
              Add sights
            </Button>
          </Form.Item>
        </>
      }

};