ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🧐[问题]为什么当使用 ProFormSelect request 返回options时,指定的key并不生效,始终以value作为key #8601

Open raotaohub opened 3 months ago

raotaohub commented 3 months ago

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🧐 问题描述

ProFormSelect 组件使用 request 异步返回options时,并没有根据开发者指定的key作为react渲染的key,这个情况存在很久了,是有意为之吗,是否应该根据用户指定的key运行?

💻 示例代码

以用户传入的key为主,没有再取value

🚑 其他信息

截图如下 image

mac066 commented 3 months ago

Is there any way around for this situation

raotaohub commented 3 months ago

Is there any way around for this situation

use options ,not request

< ProFormSelect 
  ...
  options={['1'].map(t=>({key:'key:'+t, value:'value:'+t, label:'label:'+t}))}
/>