Skip to content
New issue

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

feat: add alternative label #724

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

SCWR
Copy link

@SCWR SCWR commented Mar 14, 2022

增加一个备用的 label 渲染
在 存在表单还原场景
已选择中项有后端返回 key
但是对应选项已经被删除了
导致查找不到对应选项
希望能通过底层提供一个备用 label 来处理
避免上层再次处理 value

@vercel
Copy link

vercel bot commented Mar 14, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/select/8EFx1MGPtiJVAyTGwVmCoFbHAWf6
✅ Preview: https://select-git-fork-scwr-master-react-component.vercel.app

@SCWR
Copy link
Author

SCWR commented Apr 27, 2022

请问有进展吗

@vercel
Copy link

vercel bot commented Apr 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
select ✅ Ready (Inspect) Visit Preview Apr 27, 2022 at 8:04AM (UTC)

@SCWR
Copy link
Author

SCWR commented Apr 27, 2022

image
本地调用命令时,会报以上错误。
需要配置什么才能通过呢?
@afc163

@zombieJ
Copy link
Member

zombieJ commented Apr 28, 2022

清除 node_modules 重装,另外这个和 labelInValue 区别是什么?看起来 labelInValue HOC 一下即可?

@SCWR
Copy link
Author

SCWR commented Apr 29, 2022

清除 node_modules 重装,另外这个和 labelInValue 区别是什么?看起来 labelInValue HOC 一下即可?

清除了node_modules 重装会报这个错误

image

实现相同功能,当然可以有很多种方式。但是 labelInValue 只是把逻辑提前到上层处理,还是做了一层遍历的操作
而且并不是个简便的方式
我看了内部实现 发现 有一个 convert2LabelValues 的操作,也有遍历操作,这样的话,把上述操作放到这里处理,可以解决 80% 的场景,也提高一点点性能。也比较方便易用

现在有个场景就是 失效选项 会出现直接显示 id 的情况

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants