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

StepsForm 🧐[问题] #8566

Open xcxiao7710 opened 3 months ago

xcxiao7710 commented 3 months ago

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🧐 问题描述

formMapRef和formRef 我都赋予了初始值

并没有赋予表单初始值 我应该怎么做才能根据我初始化的数据自动赋值到表单中 因为有进行编辑操作 麻烦提供参考和建议

💻 示例代码

`<StepsForm onFinish={handleFinish} formMapRef={formMapRef} stepsFormRender={(dom, submitter) => ( <Modal title={currentRow ? '编辑模版配置' : '新增模版配置'} width={800} onCancel={() => setCreateModalOpen(false)} open={createModalOpen} footer={submitter} destroyOnClose

{dom} )}

<StepsForm.StepForm name="tables" title="数据库表" onFinish={async () => { return true; }}

<ProFormText label="数据库表" name="tableName" placeholder="请输入数据库表" rules={[{ required: true, message: '请输入数据库表' }]} /> </StepsForm.StepForm> <StepsForm.StepForm name="templates" title="模版配置" onFinish={async () => { console.log(formMapRef.current);

                    return true;
                }}
            >
                <ProFormGroup>
                    <ProFormText label="模块名称" name="module" initialValue="sys" placeholder="请输入模块名称" rules={[{ required: true, message: '请输入模块名称' }]} />
                </ProFormGroup>
            </StepsForm.StepForm>
        </StepsForm>`

🚑 其他信息

github-actions[bot] commented 3 months ago

以下的 Issues 可能会帮助到你 / The following issues may help you

fnoopv commented 3 months ago

没明白想干啥?是想要给StepsForm设置初始值吗?