We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProForm 的 params 与 request 配合使用未按返回内容重新更新表单字段。
代码:
import { ProForm, ProFormText } from '@ant-design/pro-components'; export default function TestBug({ id }: { id: number }) { async function getById() { const data = { content: `id:${id} now:${Date.now()}` }; console.log('TestBug: getById returns', data); return data; } return ( <ProForm params={{ id }} request={getById}> <ProFormText name="content" label="数据" /> </ProForm> ); }
只要相同 id 出现过,会调用 request,但不会刷新表单字段。
const [id, setId] = useState(0); setId((id) => id + 1); setId((id) => id - 1); <TestBug id={id} />
完整代码: https://stackblitz.com/edit/vitejs-vite-gfgb6m?file=src%2FApp.tsx
The text was updated successfully, but these errors were encountered:
request 是用来设置表单默认值的, 当然不会更新表单值, 和 initialValues 作用相同, 不同之处在于 1. 优先级更高, 会覆盖 initialValues 2. 可以请求远程数据。 你用错场景了
request
initialValues
Sorry, something went wrong.
有解决么 我也碰到这个问题了
No branches or pull requests
🧐 问题描述
ProForm 的 params 与 request 配合使用未按返回内容重新更新表单字段。
代码:
只要相同 id 出现过,会调用 request,但不会刷新表单字段。
完整代码:
https://stackblitz.com/edit/vitejs-vite-gfgb6m?file=src%2FApp.tsx
The text was updated successfully, but these errors were encountered: