fix(elevator): 修复点击楼层未准确高亮对应的楼层位置信息
这个 PR 做了什么? (简要描述所做更改)
修复了点击楼层导航,高亮的索引位置计算有误
这个 PR 是什么类型? (至少选择一个)
- [ ] feat: 新特性提交
- [x] fix: bug 修复
- [ ] docs: 文档改进
- [ ] style: 组件样式/交互改进
- [ ] type: 类型定义更新
- [ ] perf: 性能、包体积优化
- [ ] refactor: 代码重构、代码风格优化
- [ ] test: 测试用例
- [ ] chore(deps): 依赖升级
- [ ] chore(demo): 演示代码改进
- [ ] chore(locale): 国际化改进
- [ ] chore: 其他改动(是关于什么的改动?)
这个 PR 涉及以下平台:
- [x] NutUI H5 @nutui/nutui
- [x] NutUI Taro @nutui/nutui-taro
这个 PR 是否已自测:
Summary by CodeRabbit
-
错误修复
- 修正了
<view>标签的语法错误。
- 修正了
-
代码重构
- 简化了
clientHeight计算属性和setListGroup函数逻辑。 - 在高度计算中将
Math.floor改为Math.round。 - 在
listViewScroll函数中使用const和解构赋值来声明变量,提高了代码的可读性。 - 优化了渲染逻辑,使模板代码更加简洁。
- 简化了
Walkthrough
此次更新主要集中在简化和优化src/packages/__VUE/elevator/index.taro.vue和src/packages/__VUE/elevator/index.vue文件中的代码,消除了多余的导入,改进了计算属性的返回逻辑,优化了函数的实现,并提升了代码的可读性和性能。
Changes
| 文件路径 | 更改摘要 |
|---|---|
.../__VUE/elevator/index.taro.vue, .../__VUE/elevator/index.vue |
修复语法错误,删除nextTick导入,简化计算属性和函数逻辑,使用const和解构赋值,调整高度计算方式 |
🐇🎨
代码如歌简胜繁, 错误修复心欢颜。 变量解构显清晰, 逻辑简化更自然。
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?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
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 as PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
Attention: Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
Project coverage is 81.19%. Comparing base (
a415d0b) to head (9645921). Report is 11 commits behind head on v4.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/packages/__VUE/elevator/index.vue | 53.84% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## v4 #3149 +/- ##
==========================================
- Coverage 81.20% 81.19% -0.01%
==========================================
Files 226 226
Lines 18139 18137 -2
Branches 2485 2484 -1
==========================================
- Hits 14729 14726 -3
- Misses 3392 3393 +1
Partials 18 18
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
related issue #3145
假设某个楼层的区间在 [200, 300],为 scroll-view 组件指定 scrollTop 值并不会恰好的落在设定的值(如果设定 scrollTop: 200 可能滚动到的距离是 199.6901323132112),可能偏差 0.5 以内像素。旧逻辑如果用 Math.floor 无法精确的落在指定区间的索引,改成了 Math.round 解决。
需要将逻辑修改同步到 index.vue 文件后 pnpm dev 测试 H5 场景
需要将逻辑修改同步到
index.vue文件后pnpm dev测试 H5 场景
我在 index.taro.vue 改动了后, h5 环境是能测试通过的,一直没明白 index.vue 和 index.taro.vue 的区别,这俩文件的模板结构有点不一样🧐
需要将逻辑修改同步到
index.vue文件后pnpm dev测试 H5 场景我在
index.taro.vue改动了后, h5 环境是能测试通过的,一直没明白index.vue和index.taro.vue的区别,这俩文件的模板结构有点不一样🧐
可以参考仓库内的贡献指南(contributing)。 index.vue 是纯 H5 的组件(pnpm dev 启动),index.taro.vue 是依赖于 Taro 框架的组件(pnpm dev:h5 和 pnpm dev:weapp)。 前者对应的是 @nutui/nutui,后者对应的是@nutui/nutui-taro。
需要将逻辑修改同步到
index.vue文件后pnpm dev测试 H5 场景我在
index.taro.vue改动了后, h5 环境是能测试通过的,一直没明白index.vue和index.taro.vue的区别,这俩文件的模板结构有点不一样🧐可以参考仓库内的贡献指南(contributing)。 index.vue 是纯 H5 的组件(pnpm dev 启动),index.taro.vue 是依赖于 Taro 框架的组件(pnpm dev:h5 和 pnpm dev:weapp)。 前者对应的是 @nutui/nutui,后者对应的是@nutui/nutui-taro。
got it. 我调整下