Fix modal can not focus second input bug

This commit is contained in:
2024-03-01 16:35:49 +08:00
parent e2dfe89d04
commit 3b11b262b9
8 changed files with 178 additions and 85 deletions

View File

@@ -262,12 +262,24 @@ const Tools = () => {
const handleOnUpgradeTool = (tool: ToolVo) => {
void modal.confirm({
title: '更新工具',
getContainer: false,
centered: true,
maskClosable: true,
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />
<CancelBtn />
</>
),
content: (
<>
<AntdForm form={upgradeForm}>
<AntdForm
form={upgradeForm}
ref={(ref) => {
setTimeout(() => {
ref?.getFieldInstance('toolId').focus()
}, 50)
}}
>
<AntdForm.Item
initialValue={tool.toolId}
name={'toolId'}
@@ -287,14 +299,7 @@ const Tools = () => {
}
]}
>
<AntdInput
maxLength={10}
showCount
placeholder={'请输入版本'}
ref={(input) => {
input?.focus()
}}
/>
<AntdInput maxLength={10} showCount placeholder={'请输入版本'} />
</AntdForm.Item>
</AntdForm>
</>