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 中传递了默认值,但没有渲染在显示区域中,并且显示区域是空的,连占位符都没有显示,这说明可能有值但没有被正确渲染
运行代码
正确设置初始值
import { GetCategories } from '@/services/api/category'; import { SelectOptionType } from '@/typings'; import { ProFormSelect, ProFormSelectProps } from '@ant-design/pro-components'; import { BaseOptionType } from 'antd/es/select'; import React from 'react'; const ProformSelectCategory = <T, OptionType extends BaseOptionType = any>( props: ProFormSelectProps<T, OptionType>, ): React.ReactElement => { const fetchCategoryList = async ({ keyWords }: { keyWords: string; }): Promise<SelectOptionType[]> => { // if (!keyWords) return []; console.debug('<ProformSelectCategory> 搜索的关键字: ', keyWords, props.initialValue); try { const data = await GetCategories(); return data.map((it): SelectOptionType => { return { label: it.name!, value: it.id!, key: it.id }; }); } catch (e) { console.debug('没有找到该分类'); return []; } }; return ( <ProFormSelect<T, OptionType> fieldProps={{ labelInValue: true, }} {...props} request={fetchCategoryList} /> ); }; export default ProformSelectCategory;
The text was updated successfully, but these errors were encountered:
当前 Issue 未检测到标题,请规范填写,谢谢!
The title of the current issue is not detected, please fill in according to the specifications, thank you!
Sorry, something went wrong.
No branches or pull requests
🐛 bug 描述
ProFormSelect 中传递了默认值,但没有渲染在显示区域中,并且显示区域是空的,连占位符都没有显示,这说明可能有值但没有被正确渲染
📷 复现步骤 | Recurrence steps
运行代码
🏞 期望结果 | Expected results
正确设置初始值
💻 复现代码 | Recurrence code
© 版本信息
🚑 其他信息
The text was updated successfully, but these errors were encountered: