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 组件受控。使用 value 属性回传;选中值后,再次打开时,视图中焦点值不对问题。 #2215

Closed
Shadowzzh opened this issue Apr 29, 2024 · 0 comments · Fixed by #2222
Assignees
Labels
bug Something isn't working exemplary

Comments

@Shadowzzh
Copy link

NutUI React 包名

@nutui/nutui-react-taro

NutUI React 版本号

2.3.10

平台

h5

重现链接

https://github.com/Shadowzzh/taro-picker-demo

重现步骤

  1. 项目启动后,
  2. 点击“请选择城市”弹出 picker 主体界面;滚动 picker 从 “南京” 到 “无锡”;点击确定。
  3. 再次点击“请选择城市”弹出 picker 主体界面。滚动 picker 从 “无锡” 到 “海北藏族自治区”;点击确定。
  4. 再次点击“请选择城市”弹出 picker 主体界面。此时界面中选中的数据应该是“海北藏族自治区”但是显示的是“北京”
    然后后面的顺序就乱了

官方示例代码中(https://nutui.jd.com/taro/react/2x/#/zh-CN/component/picker),把 options 变量放到 Demo3 组件外面即可复现。

image

期望的结果是什么?

picker 组件 value 属性回传时,picker 界面能够正常显示选中的那一条数据。
选中“海北藏族自治区””后,再次弹出组件,焦点中显示的是“海北藏族自治区”

实际的结果是什么?

选中“海北藏族自治区””后,再次弹出组件,焦点中显示的是“北京”

环境信息

Taro CLI 3.6.23 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/Library/Caches/fnm_multishells/95162_1714389185757/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.5.5 - ~/Library/Caches/fnm_multishells/95162_1714389185757/bin/npm
npmPackages:
@tarojs/cli: 3.6.23 => 3.6.23
@tarojs/components: 3.6.23 => 3.6.23
@tarojs/helper: 3.6.23 => 3.6.23
@tarojs/plugin-framework-react: 3.6.23 => 3.6.23
@tarojs/plugin-html: 3.6.23 => 3.6.23
@tarojs/plugin-platform-alipay: 3.6.23 => 3.6.23
@tarojs/plugin-platform-h5: 3.6.23 => 3.6.23
@tarojs/plugin-platform-jd: 3.6.23 => 3.6.23
@tarojs/plugin-platform-qq: 3.6.23 => 3.6.23
@tarojs/plugin-platform-swan: 3.6.23 => 3.6.23
@tarojs/plugin-platform-tt: 3.6.23 => 3.6.23
@tarojs/plugin-platform-weapp: 3.6.23 => 3.6.23
@tarojs/react: 3.6.23 => 3.6.23
@tarojs/runtime: 3.6.23 => 3.6.23
@tarojs/shared: 3.6.23 => 3.6.23
@tarojs/taro: 3.6.23 => 3.6.23
@tarojs/taro-loader: 3.6.23 => 3.6.23
@tarojs/webpack5-runner: 3.6.23 => 3.6.23
babel-preset-taro: 3.6.23 => 3.6.23
eslint-config-taro: 3.6.23 => 3.6.23
react: ^18.0.0 => 18.3.1

其他补充信息

我试过下面几个版本都是会出现这个【错误】的。

"@nutui/nutui-react-taro": "^2.6.2"
"@nutui/nutui-react-taro": "^2.4.0"
"@nutui/nutui-react-taro": "^2.0.14"

在提供的 codesandbox 中使用下面这几个版本测试是没有问题的。
"@nutui/nutui-react": "^2.0.14"
"@nutui/nutui-react": "^2.6.2"

官方网站里也是没有这个问题的。
只有在【@nutui/nutui-react-taro】下会复线

@xiaoyatong xiaoyatong assigned xiaoyatong and eiinu and unassigned xiaoyatong Apr 30, 2024
@eiinu eiinu added exemplary bug Something isn't working labels Apr 30, 2024
@eiinu eiinu linked a pull request May 7, 2024 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
bug Something isn't working exemplary
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants