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 组件在Form中使用 #1953

Open
Bigpawn opened this issue Feb 22, 2024 · 7 comments · Fixed by #2990
Open

Picker 组件在Form中使用 #1953

Bigpawn opened this issue Feb 22, 2024 · 7 comments · Fixed by #2990
Assignees

Comments

@Bigpawn
Copy link

Bigpawn commented Feb 22, 2024

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.10

平台

weapp

重现链接

小程序环境无法提供

重现步骤

  1. 点击Picker,打开选择器
  2. 点击取消按钮或者蒙版关闭选择器
  3. 再次点击Picker,打开选择器
    这时候默认选中了第一个
    点击取消或者蒙版 还是选中了第一个

期望的结果是什么?

点击取消或者蒙版关闭时不要默认选中

实际的结果是什么?

第二次点击取消或者蒙版关闭时默认选中了

环境信息

No response

其他补充信息

No response

@Bigpawn
Copy link
Author

Bigpawn commented Feb 22, 2024

官网Form中的示例复制到小程序环境同样有此问题

@YlAwen
Copy link

YlAwen commented Mar 23, 2024

我也遇到了这个问题,一模一样

@YlAwen
Copy link

YlAwen commented Mar 23, 2024

试了下,不止picker在form中无法使用,单独用也有这个问题

@lmlss
Copy link

lmlss commented Apr 22, 2024

看了下 nutui 的代码,将 onConfirm 在里面作为 onChange 调用
我的解决办法:加一个 ref,在清除的时候置为 true,点确定的时候置为 false。onCancel 时根据 ref 判断是否置空

@conorzhong
Copy link
Contributor

我也遇到了,而且传value才会触发这个问题,不传就没事

@Lin-Min
Copy link

Lin-Min commented Sep 19, 2024

我也遇到了 这么久了还没修复

@Lin-Min
Copy link

Lin-Min commented Sep 19, 2024

看了下 nutui 的代码,将 onConfirm 在里面作为 onChange 调用 我的解决办法:加一个 ref,在清除的时候置为 true,点确定的时候置为 false。onCancel 时根据 ref 判断是否置空

请问具体是怎么解决的

@irisSong irisSong linked a pull request Feb 21, 2025 that will close this issue
20 tasks
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 a pull request may close this issue.

6 participants