-
Notifications
You must be signed in to change notification settings - Fork 834
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(picker): add picker-column selected class support #3216
base: v4
Are you sure you want to change the base?
Conversation
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 218 files out of 300 files are above the max files limit of 75. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the Walkthrough此次更改涉及 Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
src/packages/__VUE/picker/index.taro.vue (2)
Line range hint
123-137
: 建议优化确认处理逻辑当前实现在非 Web 环境下使用
setTimeout(confirm, 0)
可能不够可靠。建议考虑使用更稳定的方式处理确认事件。建议如下改进:
if (state.picking) { - setTimeout(() => { - confirm() - }, 0) + // 使用 nextTick 或 Promise 来确保在下一个事件循环执行 + Promise.resolve().then(() => { + confirm() + }) } else { confirm() }
Line range hint
150-160
: 建议优化索引变化检测逻辑当前的索引变化检测使用循环实现,可以使用数组方法优化代码可读性。
建议如下改进:
- let changeIndex = 0 - // 判断变化的是第几个 - for (let i = 0; i < data.detail.value?.length; i++) { - if (prevDefaultValue[i] !== data.detail.value?.[i]) { - changeIndex = i - break - } - } + const changeIndex = data.detail.value?.findIndex( + (value: number, index: number) => prevDefaultValue[index] !== value + ) ?? -1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- src/packages/__VUE/picker/index.taro.vue (1 hunks)
🔇 Additional comments (1)
src/packages/__VUE/picker/index.taro.vue (1)
40-41
: 选中状态样式实现正确!新增的类名绑定实现合理,同时保持了对原有 className 的支持。这种实现方式既保证了基础功能,又提供了良好的样式自定义能力。
这个 PR 做了什么? (简要描述所做更改)
给 Picker 当前选中的行增加了一个 className, 已便于当前调整选中行的样式
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
这个 PR 是否已自测:
Summary by CodeRabbit