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
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
我写了个form,用来处理用户输入的数值 并且转换成json的prop
在新增form里, 我可以很容易的处理,因为他直接就是number[] 我只需要在transform时写入指定 prop 就好 提交时候我需要把它变成string, 就是这样{printing_time: "11:52"]}
number[]
{printing_time: "11:52"]}
但在编辑form里, 如果我设置了initialValue,并且是string "11:52" 那么之后的value就会变得很奇怪
"11:52"
新增模式的log
这是编辑模式的log 第一行是打开edit form时候的log, 之后就是更改数值时候
他也会只显示第一第二数值
<ProFormFieldSet name={PartProps.printing_time} label='Printing Time' rules={[{ validator: (_, value: number[]) => { const [hours, minutes] = value || []; if (!hours || minutes == null) { return Promise.reject('Please input valid Printing Time') } return Promise.resolve() } }]} required transform={(value) => { console.log('transform', value) return { [PartProps.printing_time]: `${value[0]}:${value[1]}` } }} convertValue={(value) => { console.log('convert', value) return value }} > <ProFormDigit noStyle placeholder='' min={0} max={120} fieldProps={{ controls: false, suffix: 'hour' }} /> <ProFormDigit noStyle placeholder='' min={0} max={59} fieldProps={{ controls: false, suffix: 'min' }} /> </ProFormFieldSet>
当然我也尝试过直接在initialValue转换成[11,52],这个就成功
[11,52]
但我希望可以convertValue上处理这个转换
"@ant-design/pro-components": "^2.8.2", "antd": "^5.22.3",
The text was updated successfully, but these errors were encountered:
No branches or pull requests
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🧐 问题描述
我写了个form,用来处理用户输入的数值 并且转换成json的prop
在新增form里,
我可以很容易的处理,因为他直接就是
number[]
我只需要在transform时写入指定 prop 就好
提交时候我需要把它变成string, 就是这样
{printing_time: "11:52"]}
但在编辑form里,
如果我设置了initialValue,并且是string
"11:52"
那么之后的value就会变得很奇怪
💻 示例代码
期望结果
当然我也尝试过直接在initialValue转换成
[11,52]
,这个就成功但我希望可以convertValue上处理这个转换
版本
"@ant-design/pro-components": "^2.8.2",
"antd": "^5.22.3",
The text was updated successfully, but these errors were encountered: