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
提问前先看看:
` <ProFormSelect width="sm" label="字段类型" name={item.configType} initialValue={ item.configType } options={[ { label: '输入框', value: 'input' },{ label: '下拉框', value: 'select' },{ label: '日期选择', value: 'select_time_ymd' },{ label: '时间选择', value: 'select_time_hms' },{ label: '年月日时分秒', value: 'select_time_all' },{ label: '未知类型', value: NaN }, ]} />
<ProFormText width="sm" label="默认值" name={`${[item.id](http://item.id/)}.defaultValue`} initialValue={item.value} />
The text was updated successfully, but these errors were encountered:
我的表单数据是循环出来的,代码如下,取出来的configType 是个undefined: <ProFormSelect width="sm" label="字段类型" name={${item.id}.configType} initialValue={ item.configType } options={[ { label: '输入框', value: 'input' },{ label: '下拉框', value: 'select' },{ label: '日期选择', value: 'select_time_ymd' },{ label: '时间选择', value: 'select_time_hms' },{ label: '年月日时分秒', value: 'select_time_all' },{ label: '未知类型', value: NaN }, ]} />
${item.id}.configType
<ProFormDependency name={[`${item.id}.configType`]} > {({ configType }) => { console.log('configType is :', configType) if (configType === 'input') { return ( <ProFormText width="sm" label="默认值" name={`${item.id}.defaultValue`} initialValue={item.value} /> ); } else if (configType === 'select') { return ( <ProFormSelect width="sm" label="默认值" name={`${item.id}.defaultValue`} initialValue={item.value} options={options} // 确保这里定义了 options 变量 /> ); } return ( <ProFormText width="sm" label="默认值" name={`${item.id}.defaultValue`} initialValue={item.value} /> ); // 如果不是输入框或下拉框,不渲染任何组件 }} </ProFormDependency>
Sorry, something went wrong.
No branches or pull requests
提问前先看看:
🧐 问题描述
💻 示例代码
`
<ProFormSelect
width="sm"
label="字段类型"
name={item.configType}
initialValue={ item.configType }
options={[
{
label: '输入框',
value: 'input'
},{
label: '下拉框',
value: 'select'
},{
label: '日期选择',
value: 'select_time_ymd'
},{
label: '时间选择',
value: 'select_time_hms'
},{
label: '年月日时分秒',
value: 'select_time_all'
},{
label: '未知类型',
value: NaN
},
]}
/>
🚑 其他信息
The text was updated successfully, but these errors were encountered: