Skip to content
Discussion options

You must be logged in to vote

Hi @250king! I'm Dosu and I’m helping the pro-components team.

你的写法不起作用,核心原因是 StepsForm 的每一步其实是独立的表单实例,字段(如 userId)不会自动同步到下一步,ProFormDependency 只能监听当前 step 的字段,无法跨 step 联动。ignoreFormListField 主要用于 Form.List 场景,对 StepsForm 跨步无效。官方源码和社区都明确指出 StepsForm 没有内置跨步字段联动机制,ProFormDependency 只能监听当前 step 的字段变化,不能监听前一步的字段变化(即使字段名一样)相关源码分析 社区讨论

正确做法:在第一步 onFinish 时把 userId 保存到外部 state(比如 useState),第二步直接通过 props 把 userId 传给 OrderCheckTable。示例:

const [userId, setUserId] = useState();

<StepsForm
  onFinish={...}
>
  <StepsForm.StepForm
    name="user"
    onFinish={async (values) => {
      setUserId(values.userId);
      return true;
    }}
  >
    <Form.Item name="userId" rules={[{ required: true, mes…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 250king
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant