Skip to content

[Bug Report] FormGrid 在antd-v5 下无效,templateColumns没有计算出来 #4298

@superchenwb

Description

@superchenwb
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

官方示例确实没问题(https://antd5.formilyjs.org/zh-CN/components/form-grid)
但是如果从官方示例跳转到codesandbox创建一个新的例子,就失效了,只能一行显示一个

What is expected?

期望FormGrid能正常工作

What is actually happening?

FormGrid不能正常工作,只能一行显示一个

查看源码后发现templateColumns没有计算出来。我查看了@formily/antd-v5的源码,看到了使用了@formily/grid的Grid,看到了如何计算templateColumns的逻辑,看起来都没有问题。

因为官方例子是可以的,奇怪的是我在codesanbox中创建的例子里formily相关包的版本都是写死的,版本和官方demo的应该是一样的。

尝试下载并允许@formily/antd-v5包,执行yarn dev,发现是正常的,在FormGrid中打印templateColumns,发生触发了3次,第一次是空字符串,第二次和第三次是正确的,在我自己的项目中进行打印,只触发了一次。

请在codesanbox或单独创建项目进行复现。

Package

@formily/[email protected]


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions