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

Picker PickerView等组件能否支持一下number类型。 PickerValue string太难受了! #5688

Closed
codedart2018 opened this issue Sep 25, 2022 · 9 comments
Labels

Comments

@codedart2018
Copy link

codedart2018 commented Sep 25, 2022

Version of antd-mobile

eg 5.24.0

What is this feature about?

现在picker 类型是 string | null;但实际开发中的 value 更多的是number int类型的。数据库存的也是int类型。在ant design使用都是 {label: string, value: number} 但是到了mobile v5 就是{label: string, value: string},逼得我要么从数据库取出来转一次,要么自己在前端循环转一次。这样的工作太繁重了,希望能改掉这个类型加入支持number类型。跟ant design 同步!
image

ant design 的
image

@codedart2018
Copy link
Author

@awmleer 你怎么不在群里了?

@MuxinFeng
Copy link
Contributor

这类问题我在业务开发里也遇到过,有的时候枚举值默认就是 0、1、2....,然后用起来就很不方便,同理还有 Radio 组件,感觉 value 的类型都可以放开些~
如果大佬觉得可以,小弟提个 PR 做下增强~

@miracles1919
Copy link
Contributor

之前有讨论 #5199 (comment)

这个问题能改么 @MuxinFeng

@afc163
Copy link
Member

afc163 commented Sep 26, 2022

来个 PR 吧

@MuxinFeng
Copy link
Contributor

我晚点看看哈 @miracles1919

@MuxinFeng
Copy link
Contributor

MuxinFeng commented Sep 27, 2022

根据历史 issue 的讨论来看,其实更改难度不大,只是涉及的范围比较广,几乎用到 PickerView 的地方都需要做些调整,包括 propssetStatedemo文件这些地方。
我打算一并改一下,然后走下 lint 和 test,请问还有什么我没注意到的地方吗? @miracles1919 @awmleer

@codedart2018
Copy link
Author

有没有合并上来呢,最新版也没有看到类型有变化。

@MuxinFeng
Copy link
Contributor

没整明白,我的 pr 先关啦。等大佬们搞吧

@1587315093
Copy link
Contributor

#6089 已添加

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

No branches or pull requests

5 participants