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-view h5端源代码问题 #1290

Closed
freedom2012 opened this issue Jan 18, 2020 · 2 comments
Closed

picker-view h5端源代码问题 #1290

freedom2012 opened this issue Jan 18, 2020 · 2 comments
Assignees

Comments

@freedom2012
Copy link

问题描述
之前发了一个帖子说的是picker-view设置下标为零不起作用,之后看了源代码,发现代码有问题。
文件是uni-app/src/core/view/components/picker-view/index.vue
github
1、val===oldVal 个人认为这个判断是没有意义的
2、val.find((item, index) => item !== oldVal[index]) 如果oldVal为[1],而val为[0]的时候结果还是0,这样会导致页面不更新。

@zhetengbiji
Copy link
Collaborator

zhetengbiji commented Jan 19, 2020

此条判断用于过滤 app-v3 service 层数据回流

  1. val===oldVal 用于短路数组内部数据变更,如:this.value.splice(0, 1, 0)
  2. 感谢提醒,使用 find 确实存在缺陷,已修正

@freedom2012
Copy link
Author

感谢大神的帮助

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

No branches or pull requests

2 participants