🐛[BUG] ProForm request 初始化请求后端接口无法绑定
Closed this issue · 2 comments
YuZongYangHi commented
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🐛 bug 描述
我尝试使用ProForm组件,其中使用了request方法,在第一次渲染的时候请求后端接口拿到值,然后绑定给对应组件在进行绑定,但是目前看接口是正常请求了,但是返回的值无法绑定到组件。
📷 复现步骤
🏞 期望结果
💻 复现代码
<ProForm<JobScriptRequest.FastExecuteScript>
formRef={formRef}
labelCol={{ flex: '100px' }}
request={async () => {
const result = await getJobScriptVersion(36)
return {
taskName: `快速执行脚本_${moment().format("YYYYMMDDmmhhssSSS")}`,
origin: 2,
scriptType: result.data.list.jobScript.scriptType,
content: result.data.list.content,
timeout: 7200,
}
}}
labelAlign="right"
labelWrap
wrapperCol={{ flex: 1 }}
layout="horizontal"
submitter={{
render: (_, dom) => <FooterToolbar className="otas-fast-execute-script-page-form-footer-tool-bar">{dom}</FooterToolbar>,
}}
onFinish={onFinish}
>
<ProFormText
width="xl"
name="taskName"
label={intl.formatMessage({id: 'otas.fast.execute.script.form.taskName'})}
rules={[{required: true, message: intl.formatMessage({id: 'otas.fast.execute.script.form.taskName.require'})}]}
fieldProps={{showCount: true, maxLength: 60}}/>
</ProForm>
-->
© 版本信息
- ProComponents 版本: @ant-design/pro-components": "^2.7.1
- umi 版本 4.0.52
- 浏览器环境 Chrome
- 开发环境 [e.g. mac OS]
🚑 其他信息
YuZongYangHi commented
@chenshuai2144 看看这个问题? 以前版本也没这问题。
YuZongYangHi commented
我擦.. 代码变量问题 竟然没报错 。。。 忽略