Skip to content

col-picker添加搜索功能、添加下拉刷新上拉加载功能#1417

Open
Xiabaiyou wants to merge 22 commits intoMoonofweisheng:masterfrom
Xiabaiyou:master
Open

col-picker添加搜索功能、添加下拉刷新上拉加载功能#1417
Xiabaiyou wants to merge 22 commits intoMoonofweisheng:masterfrom
Xiabaiyou:master

Conversation

@Xiabaiyou
Copy link
Copy Markdown
Collaborator

@Xiabaiyou Xiabaiyou commented Dec 28, 2025

🤔 这个 PR 的性质是?(至少选择一个)

  • 日常 bug 修复
  • 新特性提交
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • CI/CD 改进
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 代码重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Summary by CodeRabbit

  • 新功能

    • 新增可配置的 Tour 引导组件与演示页;新增拖拽排序(DragSort)组件与演示页;为列选择器(ColPicker)添加本地/远程搜索、下拉刷新与上拉加载,并暴露停止刷新接口。
  • 文档

    • 添加 Tour 与 DragSort 组件完整文档;扩展 ColPicker 文档,包含搜索、刷新、加载更多示例与 API 说明。
  • 本地化

    • 补充多语言文案(Tour、DragSort、ColPicker 等新提示与标题)。
  • 样式

    • 优化 Tour、ColPicker 与 DragSort 的样式与空状态展示,支持主题适配。
  • 测试

    • 新增并更新 Tour 与 ColPicker 的单元测试,覆盖交互与错误场景。

在 global.d.ts 文件中添加 WdGuide 组件的类型声明,确保 TypeScript 项目中可以正确识别该组件。

添加引导组件主逻辑
- 将 offset、borderRadius、padding、bottomSafetyOffset 和 topSafetyOffset 的类型从数组修改为 Number
- 这种更改提高了类型定义的准确性和一致性,确保了更好的类型检查和代码质量
- 将 border-radius、padding、bottom-safety-offset 和 top-safety-offset 属性的类型从 string / number 修改为 number
- 优化文档中属性类型的准确性,提高开发者体验
- 修改 highlightStyle 和 popoverStyle 计算属性,优化样式对象的创建方式
- 移除多余的空行和注释,提高代码整洁度
- 调整 updateElementInfo、getEffectiveBoundaries、checkScrollNeeds 等函数的结构,提升可读性
- 优化 scrollUp 和 scrollDown 函数中的变量赋值和注释
- 丰富了自定义功能,包括引导内容、高亮区域、按钮等
- 优化了引导步骤的控制逻辑,支持双向绑定当前步骤
- 调整了高亮区域和引导内容的样式,提升了用户体验
- 增加了组件的响应式处理,适应不同平台和屏幕尺寸
- 优化了代码结构,提高了组件的可维护性和可测试性
- 将 manifest.json 中的 appid 从 "wxf81518e7b11ea8d8" 更改为 "wx18107b71aa1672e2"
- 添加了向导组件的单元测试文件
- 实现了对向导组件各项功能的测试,包括基本渲染、隐藏状态、步骤内容渲染、按钮显示和功能、自定义文本和样式、事件触发等
- 模拟了 uni 对象和元素查询,以适应uni-app环境

wd-guide
去除多余的打印 修复menuButtonInfo的ts报错
- 移除了多处 console.log 调试日志,清理无用输出
- 为 menuButtonInfo 添加了更精确的类型定义
- 删除了未使用的计算属性 watch
- 提取公共的默认样式函数 getDefaultStyle
- 提取公共的高亮样式计算函数 calculateHighlightStyle
- 使用 computed 属性优化高亮样式和元素信息的计算
- 简化代码结构,提高可维护性和可读性
- 优化了引导组件的滚动逻辑,确保滚动到顶部后再显示引导步骤
- 添加了系统信息更新功能,提高元素定位的准确性
- 修复了某些场景下引导步骤显示异常的问题
- 优化了代码结构,提高了组件的可维护性
- 修复重复调用导致位置计算偏差问题
- 将 controlCurrent.value 的初始值从 6 修改为 2
- 优化了控制指南的起始步骤,提高了用户体验
- 将 guide 组件重命名为 tour 组件
- 更新了相关文件和代码中的 guide 引用,改为 tour
- 调整了部分样式和命名以适应新的组件名称
- 移除旧的引导组件代码和文档
- 更新类型定义,使用通用的类型构造函数
- 优化组件属性定义,使用统一的类型创建方法
- 删除冗余的属性类型和默认值定义
- 将 guide-show 动画名称改为 tour-show,统一动画命名风格
- 此更改不影响功能,仅用于提升代码一致性和可维护性
- 新增中英文文档侧边栏目录
- 修改演示组件入口位置,确保导航一致性
- 调整标题结构,将“介绍”合并为描述文字,“基本用法”更名为“基本使用”
- 统一代码块语言标识为 html,并更新 v-model 为 :model-value 以符合 Vue 3 写法
- 补充插槽、属性和方法的说明,优化自定义内容与样式的描述
- 规范化 props 类型标注,统一数值类属性类型为 number
- 更新事件参数格式,移除冗余字段说明
- 更新本地化标题文本,保持中英文一致
- 在 H5 环境中使用 useLockScroll 返回的 lock 和 unlock 方法以正确控制滚动锁定
- 为 popoverStyle 增加更精确的 TypeScript 类型定义,提升代码可维护性
- 新增对 useLockScroll 的 mock 实现,完善组件单元测试覆盖
该提交移除了 `src/subPages/tour/index.vue` 文件中的所有内容,包括模板、脚本和样式部分。这可能是因为该页面不再需要,或其功能已被迁移至其他位置。
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 28, 2025

@Xiabaiyou is attempting to deploy a commit to the weisheng's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 28, 2025

Walkthrough

新增完整 Tour(漫游)功能与 DragSort(拖拽排序)示例组件及其样式、类型、全局声明、文档、测试、多语言项与页面注册;同时为 ColPicker 增加本地/远程搜索、下拉刷新与上拉加载能力并扩展多语言条目与演示页,包含若干样式与配置性调整。

Changes

Cohort / File(s) Summary
文档 本地化 & 导航
docs/.vitepress/locales/en-US.ts, docs/.vitepress/locales/zh-CN.ts, src/locale/en-US.json, src/locale/zh-CN.json
新增/更新侧边栏导航项(Tour)与多语言键(如 tour-title, dragSort 等),仅文档/本地化更改。
页面注册 与 首页入口
src/pages.json, src/pages/index/Index.vue, src/subPages/tour/Index.vue
注册并添加 tour 页面与首页索引项;新增演示页 src/subPages/tour/Index.vue(多个示例与触发逻辑)。
WdTour 组件(实现、样式、类型、全局声明)
src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue, .../wd-tour/types.ts, .../wd-tour/index.scss, src/uni_modules/wot-design-uni/global.d.ts, tests/components/wd-tour.test.ts
新增 WdTour 组件:props/types、位置计算、滚动调整、mask/highlight/popover、事件与方法暴露、暗色主题样式、全局类型声明与单元测试。
DragSort 组件族(实现、类型、样式、示例页)
src/uni_modules/wot-design-uni/components/wd-drag-sort/..., src/uni_modules/wot-design-uni/components/wd-drag-sort-item/..., src/uni_modules/wot-design-uni/components/wd-drag-handle/..., src/subPages/dragSort/Index.vue
新增 wd-drag-sort 及其子组件(item、handle)、类型、utils、样式与演示页,包含拖拽逻辑、auto-scroll、布局计算与多个示例。
ColPicker 功能扩展(搜索/刷新/上拉)
src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue, .../types.ts, .../index.scss, src/subPages/colPicker/Index.vue, docs/component/col-picker.md, tests/components/wd-col-picker.test.ts
为 ColPicker 添加 filterable/filter-type 等 props、远程/本地搜索事件、refresh/scroll-to-lower 事件与 stopRefresh 暴露、样式与示例页面与文档更新,测试微调。
多语言扩展(colPicker.search)
src/uni_modules/wot-design-uni/locale/lang/* (多语言文件), src/locale/en-US.json, src/locale/zh-CN.json
在众多 locale 文件中为 colPicker 加入 search 字段,并新增若干翻译键(如 dragSort, tour-title 等)。
其它 元数据/格式与小改动
src/manifest.json, .hbuilderx/launch.json, 其他样式微调文件
格式/元数据微调、新增 IDE launch 配置文件与若干 SCSS 样式调整,无业务逻辑变更。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Page as 页面/父组件
    participant Tour as WdTour 组件
    participant DOM as 目标 DOM 元素
    participant Sys as 系统信息

    Page->>Tour: 设置 modelValue = true(显示)
    activate Tour

    Tour->>DOM: querySelector / getBoundingClientRect
    DOM-->>Tour: 返回 boundingRect

    Tour->>Sys: 请求 windowHeight / 状态栏高度
    Sys-->>Tour: 返回系统信息

    Note over Tour: 计算高亮区域与 popover 位置,决定向上或向下展示

    alt 目标不可见
        Tour->>Page: 请求 scrollTo / 调整页面滚动使目标可见
    end

    loop 用户遍历步骤
        Page->>Tour: 触发 next/prev/skip/finish
        Tour->>Tour: 更新 currentIndex;emit change/next/prev/skip/finish
        Tour->>DOM: 重新查询目标元素位置
        DOM-->>Tour: boundingRect
    end

    Page->>Tour: 设置 modelValue = false(隐藏)
    deactivate Tour
Loading

Estimated code review effort

🎯 4 (复杂) | ⏱️ ~60 分钟

Possibly related PRs

Suggested reviewers

  • Moonofweisheng
  • 810505339

Poem

🐰 漫游新迹映朝光,
光圈引路步步扬,
插槽随心铺彩章,
小兔挥耳唱一腔,
旅途有你更辉煌 ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确反映了主要变更内容,即为col-picker组件添加搜索功能和下拉刷新上拉加载功能,与代码变更高度对应。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link
Copy Markdown

netlify bot commented Dec 28, 2025

Deploy Preview for wot-design-uni ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9e9537d
🔍 Latest deploy log https://app.netlify.com/projects/wot-design-uni/deploys/69820a01528fad0008ce2822
😎 Deploy Preview https://deploy-preview-1417--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (9)
src/manifest.json (1)

49-51: compatible.ignoreVersion 调整为单独块,不影响运行

这里只是在 app-plus 下显式补了一段 "compatible": { "ignoreVersion": true } 配置(或仅调整空格/缩进),对实际行为基本无影响。需要注意的是,manifest.json 中广泛使用注释,像 Biome 这类按严格 JSON 解析的工具会报错,建议在工具配置里将该文件视为 JSONC/排除检查,以免产生噪音告警。

src/pages.json (1)

1329-1344: 新增 tour/Index 子页面配置与现有模式一致

  • 路径 tour/Indexname: "tour"、MP 与非 MP 下的 navigationBarTitleText 配置方式都与其它示例子页一致,其中非 MP 使用 %tour-title%,已经在中英文 locale 中定义,可以正确本地化。
  • MP 端直接使用中文 "Tour 页面引导" 也符合当前文件其它条目的写法。

需要注意的是,本文件包含大量注释和 // #ifdef MP 这类条件编译指令,属于 uni-app 特有的“扩展 JSON”语法,对 Biome 这类严格 JSON 解析器会触发 parse 报错。建议在工具配置里将 pages.json 视为 JSONC 或从通用 JSON 规则中排除,以免产生无效告警。

src/uni_modules/wot-design-uni/components/wd-tour/types.ts (1)

80-98: 考虑按钮文本的国际化支持

默认按钮文本使用了中文硬编码("上一步"、"下一步"、"跳过"、"完成")。如果项目需要支持多语言,建议考虑使用 i18n 机制或从 locale 配置中读取默认值。

src/subPages/tour/Index.vue (1)

182-182: 未使用的 watch 导入

watch 从 Vue 导入但未在组件中使用,建议移除以保持代码整洁。

🔎 建议修复
-import { ref, watch, nextTick } from 'vue'
+import { ref, nextTick } from 'vue'
tests/components/wd-tour.test.ts (3)

59-81: Mock 设置重复

beforeEach 中的 mock 实现与初始定义(第 14-40 行)重复。建议只在 beforeEach 中使用 mockClear() 重置状态,而不是重新定义整个实现。

🔎 建议简化
 beforeEach(() => {
   vi.clearAllMocks()
-  // 重置模拟函数
-  mockUni.createSelectorQuery.mockClear()
-  mockUni.createSelectorQuery.mockImplementation(() => ({
-    select: vi.fn(() => ({
-      boundingClientRect: vi.fn((callback) => {
-        // 模拟元素位置信息
-        setTimeout(() => {
-          callback({
-            top: 100,
-            left: 50,
-            width: 200,
-            height: 100
-          })
-        }, 10)
-        return {
-          exec: vi.fn()
-        }
-      })
-    }))
-  }))
+  // vi.clearAllMocks() 已经重置了所有 mock 状态
 })

如果需要在特定测试中修改 mock 行为,可以在该测试内部单独设置。


175-175: 移除占位符注释

// ... existing code ... 看起来是开发过程中的占位符,应该移除。

🔎 建议修复
-  // ... existing code ...
-
   // 测试自定义按钮文字

121-129: 考虑使用更可靠的异步等待方式

测试中多处使用 await new Promise((resolve) => setTimeout(resolve, 100)) 等待异步操作完成,这种方式可能导致测试不稳定。建议考虑使用 @vue/test-utilsflushPromises 或轮询等待特定条件。

src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue (2)

267-267: 缺少类型注解

scrollNeeds 参数缺少类型注解,建议添加以提高代码可读性和类型安全。

🔎 建议修复
-function handleScrolling(res: ElementRect, scrollNeeds, boundaries: { top: number; bottom: number }) {
+function handleScrolling(res: ElementRect, scrollNeeds: { up: boolean; down: boolean }, boundaries: { top: number; bottom: number }) {

190-190: 空函数可添加注释说明用途

noop 函数用于阻止 touchmove 事件的默认行为,但函数名和空实现可能让其他开发者困惑。建议添加简短注释说明用途。

🔎 建议修复
+// 空函数,用于阻止 touchmove 事件冒泡和默认行为
 function noop() {}
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d7572d and 3e76200.

📒 Files selected for processing (14)
  • docs/.vitepress/locales/en-US.ts
  • docs/.vitepress/locales/zh-CN.ts
  • docs/component/tour.md
  • src/locale/en-US.json
  • src/locale/zh-CN.json
  • src/manifest.json
  • src/pages.json
  • src/pages/index/Index.vue
  • src/subPages/tour/Index.vue
  • src/uni_modules/wot-design-uni/components/wd-tour/index.scss
  • src/uni_modules/wot-design-uni/components/wd-tour/types.ts
  • src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue
  • src/uni_modules/wot-design-uni/global.d.ts
  • tests/components/wd-tour.test.ts
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-11-24T06:12:44.418Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue` 中,由于 `title` 可能会发生变化,涉及到 `title` 的优化不太容易实现,需谨慎处理。

Applied to files:

  • docs/component/tour.md
  • src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue
  • tests/components/wd-tour.test.ts
  • src/subPages/tour/Index.vue
📚 Learning: 2024-11-26T02:35:53.123Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 737
File: src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue:25-25
Timestamp: 2024-11-26T02:35:53.123Z
Learning: 在 `wd-divider.vue` 文件(路径:`src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue`)中,`props.customStyle` 是字符串类型,用于传递自定义的样式字符串。

Applied to files:

  • src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue
📚 Learning: 2024-12-05T15:55:35.371Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 761
File: src/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.vue:166-182
Timestamp: 2024-12-05T15:55:35.371Z
Learning: 在文件 `wd-message-box.vue` 的 `toggleModal` 方法中,当 `isPass` 为 `false` 时,应阻止执行 `confirm`,但不触发 `cancel` 操作。

Applied to files:

  • src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue
  • tests/components/wd-tour.test.ts
📚 Learning: 2024-11-30T06:44:18.181Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 748
File: src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue:87-128
Timestamp: 2024-11-30T06:44:18.181Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue` 文件中,当 `percentage` 为 0 时,应通过 `update` 函数处理 `percentage` 为 0 的情况,而不需要在 `updateProgress` 函数中进行特殊处理。

Applied to files:

  • tests/components/wd-tour.test.ts
🪛 Biome (2.1.2)
src/pages.json

[error] 1331-1332: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1332-1332: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1332-1333: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1334-1335: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1341-1341: Expected a property but instead found '// #ifdef MP'.

Expected a property here.

(parse)


[error] 1335-1341: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1341-1341: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1342-1343: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1343-1343: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

src/manifest.json

[error] 49-49: JSON standard does not allow comments.

(parse)


[error] 50-50: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 50-50: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 50-50: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 50-50: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

🔇 Additional comments (16)
docs/.vitepress/locales/en-US.ts (1)

228-234: 新增 Tour 文档入口与现有导航保持一致

/en-US/component/tour 链接和文案 Tour 与组件命名、其它 locale 改动一致,看起来没有问题。建议本分支里同时确保存在对应的 docs/component/tour.md 文档与路由配置,以避免导航死链。

docs/.vitepress/locales/zh-CN.ts (1)

236-241: 中文文档侧边栏新增 “Tour 漫游” 入口合理

在 “组件 > 导航” 分组中新增 Tour 漫游 且链接为 /component/tour,与英文文档、页面路由及 tour-title 文案保持一致,便于用户从中文文档直达该组件说明。

src/locale/zh-CN.json (1)

1176-1177: 新增 tour-title 文案与页面/文档保持一致

"tour-title": "Tour 漫游" 的 key 命名与现有 *-title 规则一致,且已在首页导航、pages.json、文档导航中统一使用,符合 i18n 设计。

src/pages/index/Index.vue (1)

144-150: 首页导航新增 Tour 子页接入完整

在 “导航” 分组中增加 id: 'tour',文案使用 t('tour-title'),点击跳转到 /subPages/tour/Index,与 pages.json 中的子包路由以及中英文文案配置完全对齐,集成方式与其它示例页面一致。

src/uni_modules/wot-design-uni/global.d.ts (1)

98-99: 全局组件类型新增 WdTour 与现有声明风格一致

GlobalComponents 中增加 WdTour,引用路径和写法与其它组件一致,有利于模板里直接使用 <WdTour /> 时获得类型提示,不影响运行时行为。

src/locale/en-US.json (1)

987-988: 英文文案 tour-title 与中文 key 对齐

新增 "tour-title": "Tour",与 zh-CN 中的同名 key 对应,已在首页导航和 pages.json 中复用,符合现有 i18n 命名和用法。

src/uni_modules/wot-design-uni/components/wd-tour/index.scss (3)

1-52: 基础样式实现良好

Tour 组件的基础样式结构清晰,包括固定定位的遮罩层、高亮区域和弹出框样式。动画效果 tour-show 提供了平滑的淡入体验。


106-123: 暗黑主题样式完整

暗黑主题变体覆盖了 popover、info 和 skip 元素的颜色适配,与组件整体设计保持一致。


54-94: 原始审查意见不准确,代码实现正确

嵌套的 @include e() 写法实际上正确地生成了预期的双下划线选择器(.wd-tour__prev__default),而非错误的后代选择器。根据 BEM 混入的实现($selector + $elementSeparator + $item,其中 $elementSeparator = '__'),当前代码完全符合设计意图,测试文件也验证了这一点(如 .wd-tour__skip__default.wd-tour__next__default)。

Likely an incorrect or invalid review comment.

src/uni_modules/wot-design-uni/components/wd-tour/types.ts (1)

4-13: TourStep 接口定义清晰

接口定义简洁明了,包含必要的 element 选择器和 content 内容字段,注释说明完整。

src/subPages/tour/Index.vue (1)

1-178: 演示页面功能完整

模板展示了 Tour 组件的多种使用场景,包括基本用法、自定义蒙版、自定义高亮、插槽定制等,为用户提供了全面的参考示例。

tests/components/wd-tour.test.ts (1)

83-530: 测试覆盖全面

测试用例涵盖了组件的主要功能:基本渲染、按钮交互、事件触发、蒙版控制、插槽自定义、样式属性和错误处理。整体测试设计合理。

docs/component/tour.md (1)

1-148: 文档结构清晰完整

文档涵盖了组件的基本用法、各种自定义场景、API 参考、注意事项和常见问题,为用户提供了全面的使用指南。

src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue (3)

192-226: 错误处理实现良好

updateElementInfo 函数在找不到目标元素时通过 emit('error') 通知父组件,并输出控制台日志便于调试。整体错误处理策略合理。


1-47: 模板结构清晰

模板使用了条件渲染、作用域插槽和事件处理,支持高度自定义。通过 @touchmove.stop.prevent 阻止背景滚动是正确的做法。


441-461: 平台初始化逻辑

平台特定的初始化逻辑(获取菜单按钮信息、计算 topOffset)在 setup 阶段执行。这在客户端渲染场景下是正确的,但需确保在 SSR 场景下 uni.getMenuButtonBoundingClientRect() 的调用是安全的。

Comment on lines +150 to +172
## Attributes

| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------|------|------|--------|--------|
| v-model | 是否显示引导组件 | boolean | - | false |
| steps | 引导步骤列表 | array | - | [] |
| current | 当前步骤索引,支持 v-model:current 双向绑定 | number | - | 0 |
| mask | 蒙版是否显示 | boolean | - | true |
| mask-color | 蒙版颜色(支持 rgba 格式) | string | - | rgba(0, 0, 0, 0.5) |
| offset | 引导提示框与高亮框的间距 | number | - | 20 |
| duration | 动画持续时间(毫秒) | number | - | 300 |
| border-radius | 高亮区域的圆角大小 | number | - | 8 |
| padding | 高亮区域的内边距 | number | - | 10 |
| prev-text | 上一步按钮文字 | string | - | 上一步 |
| next-text | 下一步按钮文字 | string | - | 下一步 |
| skip-text | 跳过按钮文字 | string | - | 跳过 |
| finish-text | 完成按钮文字 | string | - | 完成 |
| bottom-safety-offset | 底部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 100 |
| top-safety-offset | 顶部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 0 |
| custom-nav | 是否自定义顶部导航栏 | boolean | - | false |
| click-mask-next | 点击蒙版是否可以下一步 | boolean | - | false |
| z-index | 引导组件的层级 | number | - | 999998 |
| show-tour-buttons | 是否显示引导按钮 | boolean | - | true |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

文档与代码默认值不一致

第 162 行记录 padding 默认值为 10,但 types.ts 中定义的默认值是 8。请核实并统一。

🔎 建议修复

根据 types.ts 第 78 行 padding: makeNumberProp(8)

-| padding | 高亮区域的内边距 | number | - | 10 |
+| padding | 高亮区域的内边距 | number | - | 8 |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------|------|------|--------|--------|
| v-model | 是否显示引导组件 | boolean | - | false |
| steps | 引导步骤列表 | array | - | [] |
| current | 当前步骤索引,支持 v-model:current 双向绑定 | number | - | 0 |
| mask | 蒙版是否显示 | boolean | - | true |
| mask-color | 蒙版颜色(支持 rgba 格式) | string | - | rgba(0, 0, 0, 0.5) |
| offset | 引导提示框与高亮框的间距 | number | - | 20 |
| duration | 动画持续时间(毫秒) | number | - | 300 |
| border-radius | 高亮区域的圆角大小 | number | - | 8 |
| padding | 高亮区域的内边距 | number | - | 10 |
| prev-text | 上一步按钮文字 | string | - | 上一步 |
| next-text | 下一步按钮文字 | string | - | 下一步 |
| skip-text | 跳过按钮文字 | string | - | 跳过 |
| finish-text | 完成按钮文字 | string | - | 完成 |
| bottom-safety-offset | 底部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 100 |
| top-safety-offset | 顶部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 0 |
| custom-nav | 是否自定义顶部导航栏 | boolean | - | false |
| click-mask-next | 点击蒙版是否可以下一步 | boolean | - | false |
| z-index | 引导组件的层级 | number | - | 999998 |
| show-tour-buttons | 是否显示引导按钮 | boolean | - | true |
## Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------|------|------|--------|--------|
| v-model | 是否显示引导组件 | boolean | - | false |
| steps | 引导步骤列表 | array | - | [] |
| current | 当前步骤索引,支持 v-model:current 双向绑定 | number | - | 0 |
| mask | 蒙版是否显示 | boolean | - | true |
| mask-color | 蒙版颜色(支持 rgba 格式) | string | - | rgba(0, 0, 0, 0.5) |
| offset | 引导提示框与高亮框的间距 | number | - | 20 |
| duration | 动画持续时间(毫秒) | number | - | 300 |
| border-radius | 高亮区域的圆角大小 | number | - | 8 |
| padding | 高亮区域的内边距 | number | - | 8 |
| prev-text | 上一步按钮文字 | string | - | 上一步 |
| next-text | 下一步按钮文字 | string | - | 下一步 |
| skip-text | 跳过按钮文字 | string | - | 跳过 |
| finish-text | 完成按钮文字 | string | - | 完成 |
| bottom-safety-offset | 底部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 100 |
| top-safety-offset | 顶部安全偏移量,用于滚动计算时确保元素周围有足够的空间 | number | - | 0 |
| custom-nav | 是否自定义顶部导航栏 | boolean | - | false |
| click-mask-next | 点击蒙版是否可以下一步 | boolean | - | false |
| z-index | 引导组件的层级 | number | - | 999998 |
| show-tour-buttons | 是否显示引导按钮 | boolean | - | true |
🤖 Prompt for AI Agents
In docs/component/tour.md around lines 150 to 172, the documented default for
the "padding" attribute is 10 but the code in types.ts defines it as 8; update
the documentation to match the implementation by changing the "padding" default
value from 10 to 8 (or alternatively update types.ts if you intend the default
to be 10) and ensure the docs and types.ts use the same numeric default
(preferably align docs to types.ts which uses makeNumberProp(8)).

Comment on lines +181 to +190
## Events

| 事件名 | 说明 | 参数 |
|--------|------|------|
| change | 步骤改变时触发 | `{currentIndex: number }` |
| prev | 点击上一步按钮时触发 | `{ oldCurrent: number, current: number, total: number, isUp: number }` |
| next | 点击下一步按钮时触发 | `{ oldCurrent: number, current: number, total: number, isUp: number }` |
| finish | 点击完成按钮时触发 | `{ current: number, total: number }` |
| skip | 点击跳过按钮时触发 | `{ current: number, total: number }` |
| error | 查找引导元素出错时触发 | `{ message: string, element: string }` |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

事件参数格式建议统一

change 事件的参数格式 {currentIndex: number } 与其他事件参数格式略有差异(多了空格),建议统一格式以提高可读性。

另外,根据组件实现(emit('change', currentIndex.value)),change 事件直接传递的是 number 类型,而不是对象。文档可能需要更正。

🤖 Prompt for AI Agents
In docs/component/tour.md around lines 181 to 190, the "Events" table has an
inconsistent parameter format for the change event: it shows `{currentIndex:
number }` (extra space) and inaccurately documents an object, but the component
emits a plain number (`emit('change', currentIndex.value)`). Update the table so
the change event's parameter column reflects the actual payload (e.g., `number`
or `currentIndex: number` without extra spaces) and ensure spacing/format for
all event parameter cells is consistent with the other rows.

Comment on lines +315 to +344
function startMaskNextTour() {
scrollToTop()
showClickMaskTour.value = true
}

async function startCustomMaskTour() {
scrollToTop()
showCustomMaskTour.value = true
}

function startNoMaskTour() {
scrollToTop()
showNoMaskTour.value = true
}

function startCustomHighlightTour() {
scrollToTop()
showCustomHighlightTour.value = true
}

function startCustomContentTour() {
scrollToTop()
showCustomContentTour.value = true
}

function startControlTour() {
scrollToTop()
controlCurrent.value = 2
showControlTour.value = true
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

scrollToTop 异步处理不一致

startBasicTour 使用了 await scrollToTop() 配合 nextTick,但其他启动函数(如 startMaskNextTourstartCustomMaskTour 等)没有等待滚动完成就立即显示 tour。这可能导致高亮元素定位不准确。

🔎 建议统一异步处理
-function startMaskNextTour() {
-  scrollToTop()
-  showClickMaskTour.value = true
+async function startMaskNextTour() {
+  await scrollToTop()
+  nextTick(() => {
+    showClickMaskTour.value = true
+  })
 }

-async function startCustomMaskTour() {
-  scrollToTop()
-  showCustomMaskTour.value = true
+async function startCustomMaskTour() {
+  await scrollToTop()
+  nextTick(() => {
+    showCustomMaskTour.value = true
+  })
 }

对其他启动函数应用相同的模式。

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/subPages/tour/Index.vue around lines 315 to 344, several tour-start
functions (startMaskNextTour, startCustomMaskTour, startNoMaskTour,
startCustomHighlightTour, startCustomContentTour, startControlTour) call
scrollToTop() synchronously and immediately set showX.value flags, causing
inconsistent async behavior versus startBasicTour; update each function to await
scrollToTop() (e.g., await scrollToTop(); await nextTick() if used in
startBasicTour) before setting the showX or controlCurrent values so the page
has finished scrolling and Vue has updated layout before showing the tour,
keeping the same error handling/await pattern used in startBasicTour.

* 类型:number
* 默认值:999998
*/
zIndex: makeNumberProp(999998),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

zIndex 默认值与 SCSS 不一致

props 中 zIndex 默认值为 999998,但 SCSS 文件中硬编码了 z-index: 9999。这可能导致样式冲突。

建议在 SCSS 中使用 CSS 变量或移除硬编码值,让组件完全由 props 控制层级。

🔎 建议修复

index.scss 中移除硬编码的 z-index,或使用 CSS 变量:

 @include b(tour) {
   position: fixed;
   top: 0;
   bottom: 0;
   left: 0;
   right: 0;
-  z-index: 9999;
+  // z-index 由组件 props 动态设置

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/uni_modules/wot-design-uni/components/wd-tour/types.ts around line 143,
the props default zIndex is set to 999998 while the component SCSS hardcodes
z-index: 9999, causing inconsistent stacking; remove the hardcoded z-index in
index.scss or replace it with a CSS variable (e.g. --wd-tour-z-index) and use
that variable in SCSS, then ensure the component sets that CSS variable from the
zIndex prop (or document removing hardcode so the prop fully controls z-index).

Comment on lines +77 to +79
// #ifdef H5
const { lock, unlock } = useLockScroll(() => props.modelValue)
// #endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find useLockScroll composable implementation
find . -type f -name "*.ts" -o -name "*.js" -o -name "*.vue" | xargs grep -l "useLockScroll" | head -20

Repository: Moonofweisheng/wot-design-uni

Length of output: 396


🏁 Script executed:

# Search for lock and unlock usage specifically in wd-tour.vue
grep -n "lock\|unlock" src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue

Repository: Moonofweisheng/wot-design-uni

Length of output: 138


🏁 Script executed:

# Get the complete wd-tour.vue file to verify context
wc -l src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue

Repository: Moonofweisheng/wot-design-uni

Length of output: 138


🏁 Script executed:

# Read the useLockScroll composable implementation
cat src/uni_modules/wot-design-uni/components/composables/useLockScroll.ts

Repository: Moonofweisheng/wot-design-uni

Length of output: 869


🏁 Script executed:

# Search for actual calls to lock() or unlock() in wd-tour.vue (with parentheses)
grep -n "lock()\|unlock()\|lock(\|unlock(" src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue

Repository: Moonofweisheng/wot-design-uni

Length of output: 55


无需直接调用 lockunlock

useLockScroll 通过内部的 watch 监听器自动管理 lockunlock 的调用:当 props.modelValue 改变时,监听器会自动触发对应的 lock 或 unlock 操作。因此无需在组件中手动调用它们。可以移除不必要的解构,直接使用:

useLockScroll(() => props.modelValue)
🤖 Prompt for AI Agents
In src/uni_modules/wot-design-uni/components/wd-tour/wd-tour.vue around lines 77
to 79, the code destructures and imports lock and unlock from useLockScroll and
suggests manually calling them, but useLockScroll already watches the provided
reactive value and auto-manages locking; remove the unnecessary destructuring
and any manual calls and instead call useLockScroll(() => props.modelValue)
directly so the watch inside useLockScroll controls lock/unlock lifecycle.

- 新增 filterable 属性支持本地和远程搜索功能
- 新增 refresher-enabled 属性支持下拉刷新
- 新增 scroll-to-lower-enabled 属性支持上拉加载更多
- 新增 search、refresh、scroll-to-lower 等事件
- 新增 stopRefresh 等方法
- 新增搜索和空数据插槽
- 添加本地搜索和远程搜索示例文档
- 添加下拉刷新和上拉加载示例文档
- 添加综合案例展示搜索+刷新+加载功能
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (7)
src/locale/en-US.json (1)

970-970: 命名不一致:remote_down-and-load-more 使用了下划线

此键名使用了下划线 _,而文件中其他键名均使用连字符 - 作为分隔符。建议保持命名风格一致。

🔎 建议修改
-  "remote_down-and-load-more": "Remote download and load more",
+  "remote-down-and-load-more": "Remote download and load more",
src/subPages/colPicker/Index.vue (6)

766-771: 建议合并多个 onMounted 钩子

文件中有两个 onMounted 调用(第 129 行和第 766 行)。虽然 Vue 3 支持多个 onMounted,但将相关初始化逻辑合并到单个钩子中可以提高代码的可维护性。

🔎 建议的修改
 onMounted(async () => {
   toast.loading(t('shu-ju-jia-zai-zhong'))
   await sleep()
   toast.close()
   value2.value = ['150000', '150100', '150121']

   getMockData(0, 1).then((data) => {
     columnsAsync.value = [data]
     pageMap.value[0] = 1
   })
+
+  // 初始化综合案例第一列数据
+  pageMapComplex.value[0] = 1
+  getComplexMockData(0, 1).then((data) => {
+    columnsComplex.value = [data]
+  })
 })

-// 初始化综合案例第一列数据
-onMounted(() => {
-  pageMapComplex.value[0] = 1
-  getComplexMockData(0, 1).then((data) => {
-    columnsComplex.value = [data]
-  })
-})

456-490: 未使用的参数 selectedItems

onSearchChangeonSearch 函数中解构了 selectedItems 参数但从未使用,建议移除以保持代码清洁。

🔎 建议的修改
 const onSearchChange = ({
   searchText,
   colIndex,
-  selectedValues,
-  selectedItems
+  selectedValues
 }: {
   searchText: string
   colIndex: number
   selectedValues: (string | number)[]
-  selectedItems: Record<string, any>[]
 }) => {
   // ...
 }

 const onSearch = ({
   searchText,
   colIndex,
-  selectedValues,
-  selectedItems
+  selectedValues
 }: {
   searchText: string
   colIndex: number
   selectedValues: (string | number)[]
-  selectedItems: Record<string, any>[]
 }) => {
-  onSearchChange({ searchText, colIndex, selectedValues, selectedItems })
+  onSearchChange({ searchText, colIndex, selectedValues })
 }

561-578: 未使用的 searchText 参数

onRefreshonScrollToLower 处理器接收 searchText 参数但未使用,因为 getMockData 不支持搜索过滤。如果这是有意为之(作为简单示例),建议在代码中添加注释说明;否则应与综合案例保持一致。


623-657: 未使用的变量 DB

DB 数组在第 626 行声明但从未使用。根据注释,这似乎是为了缓存数据而设计的,但实际实现每次都动态生成数据。建议移除未使用的变量或实现预期的缓存逻辑。

🔎 建议的修改
 const getComplexMockData = (() => {
   // 生成一个包含100条数据的"数据库"
   const TOTAL_COUNT = 100
-  const DB: any[] = []

   return (colIndex: number, page: number, pageSize: number = 15, keyword: string = '') => {
     // ...
   }
 })()

279-293: 代码重复:columnChangeLocalcolumnChange1 逻辑相同

columnChangeLocal 函数与 columnChange1(第 213-227 行)的实现完全相同。作为演示代码可以接受,但如果想减少重复,可以直接复用 columnChange1

🔎 建议的修改
-const columnChangeLocal: ColPickerColumnChange = ({ selectedItem, resolve, finish }) => {
-  const areaData = findChildrenByCode(colPickerData, selectedItem.value)
-  if (areaData && areaData.length) {
-    resolve(
-      areaData.map((item) => {
-        return {
-          value: item.value,
-          label: item.text
-        }
-      })
-    )
-  } else {
-    finish()
-  }
-}
+// 复用 columnChange1
+const columnChangeLocal = columnChange1

493-505: 同样存在未使用的 selectedItems 参数

onSearchChangeonSearch 相同,此处的 selectedItems 参数也未使用,建议一并清理。

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e76200 and 94b0609.

📒 Files selected for processing (24)
  • docs/component/col-picker.md
  • src/locale/en-US.json
  • src/locale/zh-CN.json
  • src/subPages/colPicker/Index.vue
  • src/uni_modules/wot-design-uni/components/wd-col-picker/index.scss
  • src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts
  • src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue
  • src/uni_modules/wot-design-uni/locale/lang/ar-SA.ts
  • src/uni_modules/wot-design-uni/locale/lang/de-DE.ts
  • src/uni_modules/wot-design-uni/locale/lang/en-US.ts
  • src/uni_modules/wot-design-uni/locale/lang/es-ES.ts
  • src/uni_modules/wot-design-uni/locale/lang/fr-FR.ts
  • src/uni_modules/wot-design-uni/locale/lang/ja-JP.ts
  • src/uni_modules/wot-design-uni/locale/lang/ko-KR.ts
  • src/uni_modules/wot-design-uni/locale/lang/pt-PT.ts
  • src/uni_modules/wot-design-uni/locale/lang/ru-RU.ts
  • src/uni_modules/wot-design-uni/locale/lang/th-TH.ts
  • src/uni_modules/wot-design-uni/locale/lang/tr-TR.ts
  • src/uni_modules/wot-design-uni/locale/lang/ug-CN.ts
  • src/uni_modules/wot-design-uni/locale/lang/vi-VN.ts
  • src/uni_modules/wot-design-uni/locale/lang/zh-CN.ts
  • src/uni_modules/wot-design-uni/locale/lang/zh-HK.ts
  • src/uni_modules/wot-design-uni/locale/lang/zh-TW.ts
  • tests/components/wd-col-picker.test.ts
💤 Files with no reviewable changes (1)
  • tests/components/wd-col-picker.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/locale/zh-CN.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-24T06:12:44.418Z
Learnt from: Moonofweisheng
Repo: Moonofweisheng/wot-design-uni PR: 733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue` 中,由于 `title` 可能会发生变化,涉及到 `title` 的优化不太容易实现,需谨慎处理。

Applied to files:

  • src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue
🪛 markdownlint-cli2 (0.18.1)
docs/component/col-picker.md

936-936: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


937-937: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)

🔇 Additional comments (36)
src/uni_modules/wot-design-uni/locale/lang/pt-PT.ts (1)

50-51: 新增搜索提示文本,翻译准确!

新增的 search 键值对为 col-picker 组件的搜索功能提供了葡萄牙语(葡萄牙)的占位符文本。翻译 'Por favor insira'(请输入)与现有的 'Por favor selecione'(请选择)形成了恰当的语义区分,符合搜索输入框的使用场景。格式正确,包含了必要的尾随逗号。

src/uni_modules/wot-design-uni/locale/lang/tr-TR.ts (1)

55-56: 翻译准确,格式规范!

colPicker 组件添加的 search 翻译键('Ara')是正确的土耳其语翻译,与第 98 行 search 组件使用的翻译保持一致。第 55 行添加的尾随逗号符合 JavaScript/TypeScript 最佳实践。所有 16 个语言环境文件(包括 en-US、de-DE、ja-JP、zh-CN 等)均已正确更新 colPicker.search 翻译项,本地化扩展完整一致。

src/uni_modules/wot-design-uni/locale/lang/ar-SA.ts (1)

58-59: 代码语法结构正确,翻译选择恰当。

代码结构符合文件约定:第58行正确添加了尾随逗号,第59行作为对象的最后一个条目没有尾随逗号。

关于翻译一致性:原始评论提到的 colPicker.search: 'الرجاء إدخال'("请输入")与 selectPicker.filterPlaceholder: 'بحث'("搜索")的差异并非不一致,而是有意的语义区分。这个模式在所有语言环境文件中都一致使用:

  • colPicker.search 是对用户的输入提示("请输入")
  • selectPicker.filterPlaceholder 是搜索功能的占位符标签("搜索")

此模式在中文、繁体中文、越南语等所有15+种语言环境中都保持一致。该翻译选择是正确的。

src/uni_modules/wot-design-uni/locale/lang/ko-KR.ts (1)

50-51: 韩语本地化字符串添加正确

colPicker 对象正确添加了搜索占位符文本。翻译 '입력해주세요' (请输入) 符合韩语习惯,与文件中其他占位符文本的风格保持一致。

src/uni_modules/wot-design-uni/locale/lang/ru-RU.ts (1)

50-51: 俄语本地化字符串添加正确

colPicker 对象添加的搜索占位符翻译准确。'Введите' (输入) 使用了命令式动词形式,与文件中其他输入提示保持一致。

src/uni_modules/wot-design-uni/locale/lang/de-DE.ts (1)

58-59: 德语本地化字符串添加正确

搜索占位符翻译 'Bitte eingeben' (请输入) 准确且使用了礼貌用语,与文件中其他占位符文本 (如第 109 行) 的风格一致。

src/uni_modules/wot-design-uni/locale/lang/ja-JP.ts (1)

50-51: 日语本地化字符串添加正确

搜索占位符翻译 '入力してください' (请输入) 准确,使用了礼貌体形式,与文件中其他输入提示 (如第 68 行) 保持一致。

src/uni_modules/wot-design-uni/locale/lang/fr-FR.ts (1)

50-51: 法语本地化字符串添加正确

搜索占位符翻译 'Veuillez entrer' (请输入) 准确,使用了礼貌用语 'Veuillez',与文件中其他输入提示 (如第 68 行) 的风格保持一致。

src/uni_modules/wot-design-uni/locale/lang/zh-TW.ts (1)

44-44: 繁体中文本地化字符串添加正确

colPicker 对象添加的搜索占位符 '請輸入' 翻译准确,与文件中其他输入提示的风格保持一致。代码格式遵循了该文件的紧凑型编写风格。

src/uni_modules/wot-design-uni/locale/lang/th-TH.ts (1)

50-51: 泰语本地化字符串添加正确

搜索占位符翻译 'กรุณาใส่ข้อมูล' (请输入数据) 准确,使用了礼貌用语 'กรุณา',与文件中其他输入提示 (如第 72 行) 保持一致。

src/uni_modules/wot-design-uni/locale/lang/es-ES.ts (1)

50-51: 西班牙语本地化字符串添加正确

搜索占位符翻译 'Por favor ingrese' (请输入) 准确,使用了礼貌用语 'Por favor',与文件中其他输入提示 (如第 68 行) 的风格保持一致。

src/uni_modules/wot-design-uni/locale/lang/vi-VN.ts (1)

48-48: LGTM!

越南语本地化字符串添加正确,与其他语言文件保持一致。

src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts (3)

144-173: LGTM!

新增的搜索、刷新和加载相关属性定义完善,类型定义清晰,符合组件 API 设计规范。


185-218: LGTM!

新增的事件选项类型定义结构合理,字段命名清晰,能够很好地支持搜索、刷新和滚动加载功能。


224-225: LGTM!

stopRefresh 方法的添加完善了组件的公开 API,为开发者提供了手动停止刷新的能力。

docs/component/col-picker.md (3)

620-672: LGTM!

本地搜索和远程搜索的文档说明详细,代码示例清晰,能够有效指导开发者使用新功能。


674-710: LGTM!

下拉刷新与上拉加载的文档说明简洁明了,示例代码展示了正确的使用方式。


712-854: LGTM!

综合案例非常全面,展示了搜索、刷新和加载功能的组合使用,包括分页逻辑、关键词过滤等实际场景,对开发者很有参考价值。

src/uni_modules/wot-design-uni/locale/lang/zh-CN.ts (1)

54-55: LGTM!

中文本地化字符串添加正确,与其他语言文件保持一致。

src/uni_modules/wot-design-uni/locale/lang/en-US.ts (1)

58-59: LGTM!

英文本地化字符串添加正确,与其他语言文件保持一致。

src/uni_modules/wot-design-uni/locale/lang/ug-CN.ts (1)

54-55: LGTM!

维吾尔语本地化字符串添加正确,与其他语言文件保持一致。

src/uni_modules/wot-design-uni/locale/lang/zh-HK.ts (1)

40-40: LGTM!

繁体中文(香港)本地化字符串添加正确,与其他语言文件保持一致。

src/uni_modules/wot-design-uni/components/wd-col-picker/index.scss (3)

112-123: LGTM!

列表容器的样式优化合理:

  • overflowauto 改为 hidden,配合新增的 list-scroll-view 高度定义
  • 这种改动支持了下拉刷新和上拉加载功能的实现

159-164: LGTM!

加载状态的样式重构更加简洁:使用 flex 布局居中显示,移除了绝对定位,提高了代码可维护性。


166-173: LGTM!

新增的空数据状态样式设计合理,提供了良好的用户体验反馈。使用了合适的颜色和字体大小,居中显示符合视觉习惯。

src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue (5)

60-73: 搜索框实现良好

搜索框的条件渲染、插槽支持以及事件绑定实现合理,为本地和远程搜索提供了灵活的扩展能力。


219-235: 本地过滤逻辑实现合理

只过滤当前显示的列是正确的优化策略,避免了不必要的计算。大小写不敏感的匹配也提升了用户体验。


419-440: 选择项逻辑更新正确

使用 filterData 获取当前项确保了在过滤状态下选择正确的数据项,选择后清空搜索文本也是良好的用户体验设计。


514-528: 列切换时清空搜索状态

切换列时清空搜索文本并通知父组件是合理的设计,确保了状态同步。


647-652: 公开 API 扩展合理

新增的 stopRefresh 方法为外部控制刷新状态提供了必要的接口,API 设计清晰。

src/subPages/colPicker/Index.vue (6)

31-44: LGTM!

本地搜索和远程搜索的模板配置正确,事件绑定完整。


98-115: LGTM!

综合案例模板配置完整,搜索、刷新和加载功能的 props 和事件绑定正确。


325-372: LGTM!

远程搜索的数据结构(majorsgetClassesgetStudents)设计清晰,三级联动关系明确,便于演示远程搜索功能。


390-428: LGTM!

updateColumnDatagetColumnFullData 辅助函数实现正确,有效地支持了多列数据的动态更新和依赖关系处理。


659-693: LGTM!

综合案例的 columnChangeComplex 处理逻辑完整,正确处理了列变化、页码重置、数据加载和后续列清理。


695-763: LGTM!

综合案例的搜索、刷新和加载更多处理器实现完整:

  • 搜索时正确重置页码并带关键词加载
  • 刷新时正确调用 stopRefresh() 停止刷新状态
  • 加载更多时正确处理空数据情况并提示用户

Comment on lines +892 to +900
| filterable | 是否开启搜索功能(本地/远程) | boolean | - | false | - |
| filter-type | 搜索类型:'local' (本地过滤) 或 'remote' (远程搜索) | string | - | 'local' | - |
| filter-placeholder | 搜索输入框占位符 | string | - | - | - |
| refresher-enabled | 是否开启下拉刷新 | boolean | - | false | - |
| refresher-default-style| 下拉刷新默认样式 | string | 'black' / 'white' / 'none' | 'white' | - |
| refresher-background | 下拉刷新区域背景颜色 | string | - | transparent | - |
| scroll-to-lower-enabled| 是否开启上拉加载更多 | boolean | - | false | - |
| refresher-background | 下拉刷新区域背景颜色 | string | - | transparent | - |
| refresher-default-style| 下拉刷新默认样式 | string | 'black' / 'white' / 'none' | 'white' | - |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

修复属性表格中的重复条目

属性表格中 refresher-backgroundrefresher-default-style 出现了重复条目(行 896-897 和行 899-900)。请删除重复的行。

🔎 建议的修复
 | filterable             | 是否开启搜索功能(本地/远程)                                                                                                 | boolean           | -      | false   | -        |
 | filter-type            | 搜索类型:'local' (本地过滤) 或 'remote' (远程搜索)                                                                           | string            | -      | 'local' | -        |
 | filter-placeholder     | 搜索输入框占位符                                                                                                             | string            | -      | -       | -        |
 | refresher-enabled      | 是否开启下拉刷新                                                                                                              | boolean           | -      | false   | -        |
 | refresher-default-style| 下拉刷新默认样式                                                                                                              | string            | 'black' / 'white' / 'none' | 'white' | - |
 | refresher-background   | 下拉刷新区域背景颜色                                                                                                          | string            | -      | transparent | -    |
 | scroll-to-lower-enabled| 是否开启上拉加载更多                                                                                                          | boolean           | -      | false   | -        |
-| refresher-background   | 下拉刷新区域背景颜色                                                                                                          | string            | -      | transparent | -    |
-| refresher-default-style| 下拉刷新默认样式                                                                                                              | string            | 'black' / 'white' / 'none' | 'white' | - |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| filterable | 是否开启搜索功能(本地/远程) | boolean | - | false | - |
| filter-type | 搜索类型:'local' (本地过滤) 或 'remote' (远程搜索) | string | - | 'local' | - |
| filter-placeholder | 搜索输入框占位符 | string | - | - | - |
| refresher-enabled | 是否开启下拉刷新 | boolean | - | false | - |
| refresher-default-style| 下拉刷新默认样式 | string | 'black' / 'white' / 'none' | 'white' | - |
| refresher-background | 下拉刷新区域背景颜色 | string | - | transparent | - |
| scroll-to-lower-enabled| 是否开启上拉加载更多 | boolean | - | false | - |
| refresher-background | 下拉刷新区域背景颜色 | string | - | transparent | - |
| refresher-default-style| 下拉刷新默认样式 | string | 'black' / 'white' / 'none' | 'white' | - |
| filterable | 是否开启搜索功能(本地/远程) | boolean | - | false | - |
| filter-type | 搜索类型:'local' (本地过滤) 或 'remote' (远程搜索) | string | - | 'local' | - |
| filter-placeholder | 搜索输入框占位符 | string | - | - | - |
| refresher-enabled | 是否开启下拉刷新 | boolean | - | false | - |
| refresher-default-style| 下拉刷新默认样式 | string | 'black' / 'white' / 'none' | 'white' | - |
| refresher-background | 下拉刷新区域背景颜色 | string | - | transparent | - |
| scroll-to-lower-enabled| 是否开启上拉加载更多 | boolean | - | false | - |
🤖 Prompt for AI Agents
In docs/component/col-picker.md around lines 892 to 900, the table contains
duplicate rows for refresher-background and refresher-default-style (appearing
twice at lines ~896-897 and ~899-900); remove the duplicate entries so each
property appears only once, keeping a single instance of refresher-default-style
and refresher-background and preserving the rest of the table formatting and
ordering.

Comment on lines +936 to +940
| open | 打开 picker 弹框 | - |
| close | 关闭 picker 弹框 | - |
| stopRefresh | 停止下拉刷新 | - | - |
| getCurrentColData | 获取当前列数据 | colIndex | - |
| getAllColData | 获取所有列数据 | - | - |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

修复方法表格的格式问题

方法表格中 stopRefreshgetCurrentColDatagetAllColData 的行缺少"最低版本"列的值。请补充完整或使用 - 占位。

🔎 建议的修复
 | 方法名称 | 说明             | 参数 | 最低版本 |
 | -------- | ---------------- | ---- | -------- |
 | open     | 打开 picker 弹框 | -    | -        |
 | close    | 关闭 picker 弹框 | -    | -        |
-| stopRefresh | 停止下拉刷新 | - | - |
-| getCurrentColData | 获取当前列数据 | colIndex | - |
-| getAllColData | 获取所有列数据 | - | - |
+| stopRefresh | 停止下拉刷新 | -    | -        |
+| getCurrentColData | 获取当前列数据 | colIndex | -        |
+| getAllColData | 获取所有列数据 | -    | -        |

基于静态分析工具的提示。

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

936-936: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


937-937: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)

🤖 Prompt for AI Agents
In docs/component/col-picker.md around lines 936 to 940, the methods table has
missing "最低版本" column values for the rows stopRefresh, getCurrentColData and
getAllColData; update those three rows to include a placeholder '-' (or the
correct minimum version if known) in the missing column so every row has four
columns and the table alignment is fixed.

Comment on lines +383 to +388
function filterData(items: any[], searchText: string): any[] {
const searchKeyword = searchText.toLowerCase().trim()
if (!searchKeyword) return items // 空字符串返回全部数据

return items.filter((item) => item.label.toLowerCase().includes(searchKeyword) || item.value.toLowerCase().includes(searchKeyword))
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

类型安全问题:item.value 可能不是字符串

filterData 函数对 item.value 调用 toLowerCase(),如果 value 是数字类型会导致运行时错误。

🔎 建议的修复
 function filterData(items: any[], searchText: string): any[] {
   const searchKeyword = searchText.toLowerCase().trim()
   if (!searchKeyword) return items // 空字符串返回全部数据

-  return items.filter((item) => item.label.toLowerCase().includes(searchKeyword) || item.value.toLowerCase().includes(searchKeyword))
+  return items.filter((item) => item.label.toLowerCase().includes(searchKeyword) || String(item.value).toLowerCase().includes(searchKeyword))
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function filterData(items: any[], searchText: string): any[] {
const searchKeyword = searchText.toLowerCase().trim()
if (!searchKeyword) return items // 空字符串返回全部数据
return items.filter((item) => item.label.toLowerCase().includes(searchKeyword) || item.value.toLowerCase().includes(searchKeyword))
}
function filterData(items: any[], searchText: string): any[] {
const searchKeyword = searchText.toLowerCase().trim()
if (!searchKeyword) return items // 空字符串返回全部数据
return items.filter((item) => item.label.toLowerCase().includes(searchKeyword) || String(item.value).toLowerCase().includes(searchKeyword))
}
🤖 Prompt for AI Agents
In src/subPages/colPicker/Index.vue around lines 383 to 388, filterData calls
toLowerCase() on item.value which may be a non-string (e.g., number) causing a
runtime error; change the check to safely coerce value to string before calling
toLowerCase (or guard with typeof), e.g. obtain a stringValue = item.value ==
null ? "" : String(item.value) and use stringValue.toLowerCase().trim() (and
likewise ensure item.label is treated as string) so numeric or null values won't
throw.

Comment on lines +510 to +525
const getMockData = (colIndex: number, page: number, pageSize: number = 15) => {
return new Promise<any[]>((resolve) => {
setTimeout(() => {
const data: any[] = []
for (let i = 0; i < pageSize; i++) {
const id = (page - 1) * pageSize + i + 1
data.push({
label: colIndex === 0 ? `选项${id}` : `子选项${colIndex}-${id}`,
value: colIndex === 0 ? `${id}` : `${colIndex}-${id}`
})
}
uni.hideLoading()
resolve(data)
}, 1000)
})
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

关注点分离问题:getMockData 内部调用 uni.hideLoading()

getMockData 函数在第 521 行调用了 uni.hideLoading(),但调用者(如 columnChangeAsynconRefresh)也会管理 loading 状态。这种混合控制可能导致 UI 状态不一致。

建议将 loading 状态管理完全交给调用者处理。

🔎 建议的修改
 const getMockData = (colIndex: number, page: number, pageSize: number = 15) => {
   return new Promise<any[]>((resolve) => {
     setTimeout(() => {
       const data: any[] = []
       for (let i = 0; i < pageSize; i++) {
         const id = (page - 1) * pageSize + i + 1
         data.push({
           label: colIndex === 0 ? `选项${id}` : `子选项${colIndex}-${id}`,
           value: colIndex === 0 ? `${id}` : `${colIndex}-${id}`
         })
       }
-      uni.hideLoading()
       resolve(data)
     }, 1000)
   })
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const getMockData = (colIndex: number, page: number, pageSize: number = 15) => {
return new Promise<any[]>((resolve) => {
setTimeout(() => {
const data: any[] = []
for (let i = 0; i < pageSize; i++) {
const id = (page - 1) * pageSize + i + 1
data.push({
label: colIndex === 0 ? `选项${id}` : `子选项${colIndex}-${id}`,
value: colIndex === 0 ? `${id}` : `${colIndex}-${id}`
})
}
uni.hideLoading()
resolve(data)
}, 1000)
})
}
const getMockData = (colIndex: number, page: number, pageSize: number = 15) => {
return new Promise<any[]>((resolve) => {
setTimeout(() => {
const data: any[] = []
for (let i = 0; i < pageSize; i++) {
const id = (page - 1) * pageSize + i + 1
data.push({
label: colIndex === 0 ? `选项${id}` : `子选项${colIndex}-${id}`,
value: colIndex === 0 ? `${id}` : `${colIndex}-${id}`
})
}
resolve(data)
}, 1000)
})
}
🤖 Prompt for AI Agents
In src/subPages/colPicker/Index.vue around lines 510 to 525, getMockData
currently calls uni.hideLoading() inside the helper which mixes UI loading
control with data fetching; remove the uni.hideLoading() call from getMockData
and let callers (e.g., columnChangeAsync, onRefresh) manage showing/hiding
loading so loading state is consistent—update callers if needed to call
uni.hideLoading() after awaiting getMockData and ensure error paths also hide
loading.

Comment on lines +535 to +539
uni.showLoading({
title: '加载中...',
mask: true,
icon: 'none'
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

uni-app uni.showLoading API documentation parameters

💡 Result:

uni.showLoading(options)

Parameters (options):

  • title: string — prompt text (required). [1]
  • mask: boolean — whether to show a transparent modal mask to prevent touch-through (optional, default: false). [1]
  • success: (res) => void — success callback (optional). [1]
  • fail: (res) => void — failure callback (optional). [1]
  • complete: (res) => void — called when API finishes (optional). [1]

Notes:

  • The loading must be closed with uni.hideLoading(). [1][2]

Sources:
[1] uni-app API — showLoading documentation.
[2] uni-app API overview.


移除无效的 API 参数 icon

uni.showLoading 不支持 icon 参数。该参数属于 uni.showToast 的选项,不应在此处使用。虽然不会导致错误,但应移除该无效参数。

   uni.showLoading({
     title: '加载中...',
     mask: true,
-    icon: 'none'
   })

同样的问题也存在于第 585-589 行、第 670 行和第 738 行。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uni.showLoading({
title: '加载中...',
mask: true,
icon: 'none'
})
uni.showLoading({
title: '加载中...',
mask: true
})
🤖 Prompt for AI Agents
In src/subPages/colPicker/Index.vue around lines 535-539 (and similarly at
585-589, 670, and 738), the uni.showLoading calls include an invalid icon
parameter (icon is only valid for uni.showToast); remove the icon property from
these uni.showLoading option objects so only supported keys (e.g., title, mask)
remain, and ensure formatting/indentation is preserved after removal.

@@ -1,4 +1,4 @@
import type { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue'
import { handleError, type ComponentPublicInstance, type ExtractPropTypes, type PropType } from 'vue'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# 首先检查 types.ts 文件的内容和 handleError 的具体使用
cat -n src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts | head -50

Repository: Moonofweisheng/wot-design-uni

Length of output: 1528


🏁 Script executed:

# 检查 handleError 在该文件中的所有使用
rg -n "handleError" src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts

Repository: Moonofweisheng/wot-design-uni

Length of output: 176


🏁 Script executed:

# 检查整个 wd-col-picker 目录中对 handleError 的使用
rg -n "handleError" src/uni_modules/wot-design-uni/components/wd-col-picker/

Repository: Moonofweisheng/wot-design-uni

Length of output: 241


🏁 Script executed:

# 检查是否被重新导出或用于类型定义
rg -n "handleError" src/uni_modules/wot-design-uni/components/wd-col-picker/ -B2 -A2

Repository: Moonofweisheng/wot-design-uni

Length of output: 567


🏁 Script executed:

# 获取整个 types.ts 文件的完整内容,检查是否有其他使用方式
wc -l src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts

Repository: Moonofweisheng/wot-design-uni

Length of output: 141


🏁 Script executed:

# 查看完整文件内容
cat src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts

Repository: Moonofweisheng/wot-design-uni

Length of output: 5469


删除未使用的导入 handleError

handleError 在此文件中未被使用,应从导入语句中移除。

🤖 Prompt for AI Agents
In src/uni_modules/wot-design-uni/components/wd-col-picker/types.ts around line
1, the import statement includes handleError which is not used; remove
handleError from the imported identifiers so the import only brings in the used
types (ComponentPublicInstance, ExtractPropTypes, PropType) to eliminate the
unused-import warning.

Comment on lines +113 to +117
<template v-else>
<slot name="empty">
<wd-status-tip image="content" tip="暂无内容" />
</slot>
</template>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

国际化问题:硬编码的中文文本

"暂无内容" 是硬编码的中文文本,这破坏了组件的国际化支持。应使用 translate 函数来确保多语言兼容。

🔎 建议修改
             <template v-else>
               <slot name="empty">
-                <wd-status-tip image="content" tip="暂无内容" />
+                <wd-status-tip image="content" :tip="translate('empty')" />
               </slot>
             </template>

同时需要在 locale 文件中添加对应的翻译键。

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue
around lines 113-117, the empty-state text "暂无内容" is hard-coded in Chinese;
replace it with a call to the translate function (e.g.
translate('wdColPicker.empty') or the project's i18n helper) so the string is
localized, and update the locale files (all supported languages) to add the
corresponding translation key and values for the empty state.

Comment on lines +642 to +645
function stopRefresh() {
refreshTriggered.value = false
console.log('[wd-col-picker] 停止刷新状态')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

移除调试日志

console.log 语句不应保留在生产代码中,建议删除。

🔎 建议修改
 function stopRefresh() {
   refreshTriggered.value = false
-  console.log('[wd-col-picker] 停止刷新状态')
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function stopRefresh() {
refreshTriggered.value = false
console.log('[wd-col-picker] 停止刷新状态')
}
function stopRefresh() {
refreshTriggered.value = false
}
🤖 Prompt for AI Agents
In src/uni_modules/wot-design-uni/components/wd-col-picker/wd-col-picker.vue
around lines 642 to 645, the stopRefresh function contains a console.log call
that should not be in production; remove the console.log('[wd-col-picker]
停止刷新状态') line (or replace it with a proper framework logger or a conditional
debug-only logger) so the function only sets refreshTriggered.value = false
without emitting debug output.

移除了 getCurrentColData 和 getAllColData 方法的文档说明,
这些方法已在组件中移除。
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/component/col-picker.md (1)

883-883: 修复 auto-complete 属性的类型列缺失

auto-complete 属性行缺少"类型"列的值。根据其默认值 false 和功能描述,该属性的类型应为 boolean

🔎 建议的修复
-| auto-complete          | 自动触发 column-change 事件来补全数据,当 columns 为空数组或者 columns 数组长度小于 value 数组长度时,会自动触发 column-change | -                 | false  | -       |
+| auto-complete          | 自动触发 column-change 事件来补全数据,当 columns 为空数组或者 columns 数组长度小于 value 数组长度时,会自动触发 column-change | boolean           | -      | false   | -       |
♻️ Duplicate comments (1)
docs/component/col-picker.md (1)

899-900: 删除属性表中的重复条目

属性表中 refresher-backgroundrefresher-default-style 出现了重复(第899-900行与第896-897行重复)。请删除重复的行。

🔎 建议的修复
 | refresher-enabled      | 是否开启下拉刷新                                                                                              | boolean           | -      | false   | -        |
 | refresher-default-style| 下拉刷新默认样式                                                                                              | string            | 'black' / 'white' / 'none' | 'white' | - |
 | refresher-background   | 下拉刷新区域背景颜色                                                                                          | string            | -      | transparent | -    |
 | scroll-to-lower-enabled| 是否开启上拉加载更多                                                                                          | boolean           | -      | false   | -        |
-| refresher-background   | 下拉刷新区域背景颜色                                                                                          | string            | -      | transparent | -    |
-| refresher-default-style| 下拉刷新默认样式                                                                                              | string            | 'black' / 'white' / 'none' | 'white' | - |
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94b0609 and fd5500b.

📒 Files selected for processing (1)
  • docs/component/col-picker.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/component/col-picker.md

936-936: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


937-937: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)

🔇 Additional comments (2)
docs/component/col-picker.md (2)

620-854: 新增功能文档实现完整且清晰

搜索、下拉刷新和上拉加载功能的文档编写质量很好:

  • 本地搜索和远程搜索的区别清晰可辨
  • 综合案例展示了分页、关键词过滤和数据加载的完整流程
  • 事件回调和方法调用的说明准确
  • 代码示例遵循项目文档风格并包含必要的注释

926-947: 新增事件和插槽文档准确完整

事件文档清晰列出了各个事件的触发时机和回调参数结构,参数名称和数据类型定义准确。新增的 searchsearchsearch-changesearch-clearrefreshscroll-to-lower 事件均有恰当的说明。插槽文档(searchempty)的格式与现有插槽保持一致。

Comment on lines 936 to 937
| open | 打开 picker 弹框 | - |
| close | 关闭 picker 弹框 | - |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

修复方法表的列格式问题

方法表中 openclose 的行缺少"最低版本"列的值。请添加占位符 - 以保持表格结构完整。

🔎 建议的修复
 | 方法名称 | 说明             | 参数 | 最低版本 |
 | -------- | ---------------- | ---- | -------- |
-| open     | 打开 picker 弹框 | -    |
-| close    | 关闭 picker 弹框 | -    |
+| open     | 打开 picker 弹框 | -    | -        |
+| close    | 关闭 picker 弹框 | -    | -        |
 | stopRefresh | 停止下拉刷新 | - | - |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| open | 打开 picker 弹框 | - |
| close | 关闭 picker 弹框 | - |
| 方法名称 | 说明 | 参数 | 最低版本 |
| -------- | ---------------- | ---- | -------- |
| open | 打开 picker 弹框 | - | - |
| close | 关闭 picker 弹框 | - | - |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

936-936: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


937-937: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)

🤖 Prompt for AI Agents
In docs/component/col-picker.md around lines 936 to 937, the method table rows
for `open` and `close` are missing the "最低版本" column value; update those two
rows to include the placeholder `-` in the "最低版本" cell so the table column
alignment is preserved (i.e., ensure each row has the same number of
pipe-separated cells by adding `-` as the third column for both `open` and
`close`).

- 在文档导航中添加 DragSort 拖拽排序组件链接
- 添加英文和中文国际化配置
- 配置页面路由和导航标题
- 在首页组件列表中注册新组件
- 在全局类型定义中声明组件类型
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@src/pages.json`:
- Around line 1346-1357: The navigation bar title for the dragSort page is
hardcoded and should use the project's i18n key instead; update the
style.navigationBarTitleText entries inside the "dragSort/Index" (name
"dragSort") block for both MP and non-MP branches to reference the existing
title key used elsewhere (e.g. replace the fixed "DragSort 拖拽排序" string with the
i18n key such as "pages.dragSort.title" or the project's actual title key) so
the page uses the language pack consistently.

In `@src/subPages/dragSort/Index.vue`:
- Around line 394-396: handleScroll currently does currentScrollTop.value += dy
which can drive currentScrollTop below 0 when dy is negative; update
handleScroll to clamp currentScrollTop.value to a minimum of 0 after applying dy
(use the existing currentScrollTop and dy variables inside handleScroll) so the
scroll accumulation never becomes negative.

In
`@src/uni_modules/wot-design-uni/components/wd-drag-sort-item/wd-drag-sort-item.vue`:
- Around line 239-320: isHandleTriggered is left true after a handle-initiated
drag, causing later non-handle touches to bypass the useDragHandle check; reset
this flag when touch finishes or is cancelled. Modify onTouchEnd (and the
touch-cancel path if present) to set isHandleTriggered = false (and also
consider setting it false after calling startDragLogic inside onHandleTouch) so
that subsequent onTouchStart correctly enforces parent.props.useDragHandle;
update the functions onHandleTouch, onTouchStart, and onTouchEnd to ensure the
flag is cleared after drag start or end.

In `@src/uni_modules/wot-design-uni/components/wd-drag-sort/wd-drag-sort.vue`:
- Around line 322-333: The onBeforeUnmount cleanup omits initDebounceTimer so a
pending debounce can fire dragInit after unmount; in the onBeforeUnmount handler
(the one that currently clears updateTimer and silentTimer) also check for
initDebounceTimer, call clearTimeout(initDebounceTimer) and set
initDebounceTimer = null to fully cancel the pending debounce and prevent
dragInit from running post-unmount.
- Around line 164-169: The layout mapping can be incomplete when some child
rects are null: in the Promise.all(promises).then(...) block check if
validRects.length < children.length and, if so, retry the measurement instead of
calling handleLayout; implement a bounded retry (e.g. re-enqueue the measurement
via setTimeout or re-run the promise collection up to a maxRetries counter) and
only call handleLayout(containerRect, validRects) and resolve() when
validRects.length === children.length (or reject/resolve with a clear fallback
after maxRetries) to ensure items/slots mapping remains consistent for drag
operations.
🧹 Nitpick comments (3)
docs/.vitepress/locales/zh-CN.ts (2)

238-241: 格式不一致:link: 缺少空格,且花括号格式与文件其他部分不统一。

与文件中其他条目相比,这里的格式有偏差:冒号后缺少空格,且 },{ 在同一行。

♻️ 建议的格式修复
-            },{
-              link:'/component/tour',
+            },
+            {
+              link: '/component/tour',
               text: 'Tour 漫游'
             }

413-417: 缩进不一致:DragSort 条目的缩进与同级其他条目不匹配。

当前使用了 6 个空格缩进,而该区块内其他条目使用的是 14 个空格。这会影响代码的可读性和一致性。

♻️ 建议的缩进修复
             {
               link: '/component/number-keyboard',
               text: 'NumberKeyboard 数字键盘'
             },
             {
-      link: '/component/drag-sort',
-      text: 'DragSort 拖拽排序'
-    }
+              link: '/component/drag-sort',
+              text: 'DragSort 拖拽排序'
+            }
           ]
src/uni_modules/wot-design-uni/components/wd-drag-sort/utils.ts (1)

1-16: 节流函数与现有实现重复,建议复用以保持语义一致。

项目里已有 src/uni_modules/wot-design-uni/components/common/util.tsthrottle,避免两套实现行为分叉更稳妥。

♻️ 建议调整
-/**
- * 节流函数
- * `@param` {Function} fn - 需要节流的函数
- * `@param` {Number} delay - 延迟时间(ms)
- * `@returns` {Function}
- */
-export const throttle = (fn: (...args: any[]) => void, delay: number) => {
-  let last = 0
-  return (...args: any[]) => {
-    const now = Date.now()
-    if (now - last > delay) {
-      last = now
-      fn(...args)
-    }
-  }
-}
+export { throttle } from '../common/util'

Comment on lines +1346 to +1357
"path": "dragSort/Index",
"name": "dragSort",
"style": {
"mp-alipay": {
"allowsBounceVertical": "NO"
},
// #ifdef MP
"navigationBarTitleText": "DragSort 拖拽排序",
// #endif
// #ifndef MP
"navigationBarTitleText": "DragSort 拖拽排序"
// #endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

非 MP 标题缺少多语言占位符。

当前使用固定文案,无法随语言包切换;与其他页面不一致。建议替换为已有的标题 key(按项目实际 key 调整)。

🔧 建议修改
-            "navigationBarTitleText": "DragSort 拖拽排序"
+            "navigationBarTitleText": "%dragsort-title%"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"path": "dragSort/Index",
"name": "dragSort",
"style": {
"mp-alipay": {
"allowsBounceVertical": "NO"
},
// #ifdef MP
"navigationBarTitleText": "DragSort 拖拽排序",
// #endif
// #ifndef MP
"navigationBarTitleText": "DragSort 拖拽排序"
// #endif
"path": "dragSort/Index",
"name": "dragSort",
"style": {
"mp-alipay": {
"allowsBounceVertical": "NO"
},
// `#ifdef` MP
"navigationBarTitleText": "DragSort 拖拽排序",
// `#endif`
// `#ifndef` MP
"navigationBarTitleText": "%dragsort-title%"
// `#endif`
🧰 Tools
🪛 Biome (2.3.13)

[error] 1346-1347: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1348-1349: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1349-1349: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1349-1349: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1350-1351: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1356-1357: Expected a property but instead found '// #ifdef MP'.

Expected a property here.

(parse)


[error] 1351-1356: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 1356-1357: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

🤖 Prompt for AI Agents
In `@src/pages.json` around lines 1346 - 1357, The navigation bar title for the
dragSort page is hardcoded and should use the project's i18n key instead; update
the style.navigationBarTitleText entries inside the "dragSort/Index" (name
"dragSort") block for both MP and non-MP branches to reference the existing
title key used elsewhere (e.g. replace the fixed "DragSort 拖拽排序" string with the
i18n key such as "pages.dragSort.title" or the project's actual title key) so
the page uses the language pack consistently.

Comment on lines +394 to +396
function handleScroll({ dy }: { dx: number; dy: number }) {
currentScrollTop.value += dy
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

滚动累计值可能出现负值。

拖拽向上自动滚动时 dy 可能为负且已到顶部,currentScrollTop 可能小于 0,建议做下限保护。

🧩 建议修复
 function handleScroll({ dy }: { dx: number; dy: number }) {
-  currentScrollTop.value += dy
+  currentScrollTop.value = Math.max(0, currentScrollTop.value + dy)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function handleScroll({ dy }: { dx: number; dy: number }) {
currentScrollTop.value += dy
}
function handleScroll({ dy }: { dx: number; dy: number }) {
currentScrollTop.value = Math.max(0, currentScrollTop.value + dy)
}
🤖 Prompt for AI Agents
In `@src/subPages/dragSort/Index.vue` around lines 394 - 396, handleScroll
currently does currentScrollTop.value += dy which can drive currentScrollTop
below 0 when dy is negative; update handleScroll to clamp currentScrollTop.value
to a minimum of 0 after applying dy (use the existing currentScrollTop and dy
variables inside handleScroll) so the scroll accumulation never becomes
negative.

Comment on lines +239 to +320
const onTouchStart = (e: any) => {
// 如果事件已经被 handle 处理过,则忽略
if (e.__handledByHandle) return

// 如果开启了 useDragHandle,但不是由 handle 触发的,则忽略
if (parent && parent.props.useDragHandle && !isHandleTriggered) {
return
}

// 重置标志位
isHandleTriggered = false

startDragLogic(e)
}

/**
* 供 Slot 使用的 Handle TouchStart
*/
const onHandleTouch = (e: any) => {
if (parent && parent.props.useDragHandle) {
isHandleTriggered = true
startDragLogic(e)

// 阻止 Root 再次响应(如果冒泡的话)
// 给 event 对象加个标记
e.__handledByHandle = true
}
}

/**
* 触摸移动处理
*/
const handleTouchMove = (e: any) => {
if (!parent) return
// 阻止冒泡,避免嵌套问题
if (e.stopPropagation) {
e.stopPropagation()
}
// 如果正在拖拽,阻止默认行为(滚动)
if (isDraggingActive.value && e.preventDefault) {
e.preventDefault()
}

const touch = getTouch(e)

// 检查是否已经开始拖拽
if (isDraggingActive.value && parent.draggedIndex.value === props.index) {
// 已经在拖拽中,处理拖拽移动
parent.onDragMove(touch)
return
}

// 如果没有开始拖拽,检查是否需要取消长按定时器
const movedDistance = getDistance(touch.clientX, touch.clientY, touchStartPosition.x, touchStartPosition.y)

// 如果设置了长按延迟
if (parent.props.longPressDuration > 0) {
if (longPressTimer) {
// 还没到长按时间,移动超过阈值就取消长按
if (movedDistance > 15) {
clearTimeout(longPressTimer)
longPressTimer = null
// 这里返回,允许页面滚动
return
}
}
}
}

/**
* 触摸结束/取消处理
*/
const onTouchEnd = () => {
if (longPressTimer) {
clearTimeout(longPressTimer)
longPressTimer = null
}

if (isDraggingActive.value) {
isDraggingActive.value = false
if (parent) parent.onDragEnd()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

useDragHandle 下 isHandleTriggered 未复位会导致后续非 handle 触摸也触发拖拽。

handle 触发后若根节点 onTouchStart 早退,isHandleTriggered 会一直为 true,下一次普通触摸会绕过 useDragHandle 校验。建议在触摸结束/取消时复位(或在 onHandleTouch 后立即复位)。

🔧 建议修复
 const onTouchEnd = () => {
   if (longPressTimer) {
     clearTimeout(longPressTimer)
     longPressTimer = null
   }
+  isHandleTriggered = false
   if (isDraggingActive.value) {
     isDraggingActive.value = false
     if (parent) parent.onDragEnd()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onTouchStart = (e: any) => {
// 如果事件已经被 handle 处理过,则忽略
if (e.__handledByHandle) return
// 如果开启了 useDragHandle,但不是由 handle 触发的,则忽略
if (parent && parent.props.useDragHandle && !isHandleTriggered) {
return
}
// 重置标志位
isHandleTriggered = false
startDragLogic(e)
}
/**
* 供 Slot 使用的 Handle TouchStart
*/
const onHandleTouch = (e: any) => {
if (parent && parent.props.useDragHandle) {
isHandleTriggered = true
startDragLogic(e)
// 阻止 Root 再次响应(如果冒泡的话)
// 给 event 对象加个标记
e.__handledByHandle = true
}
}
/**
* 触摸移动处理
*/
const handleTouchMove = (e: any) => {
if (!parent) return
// 阻止冒泡,避免嵌套问题
if (e.stopPropagation) {
e.stopPropagation()
}
// 如果正在拖拽,阻止默认行为(滚动)
if (isDraggingActive.value && e.preventDefault) {
e.preventDefault()
}
const touch = getTouch(e)
// 检查是否已经开始拖拽
if (isDraggingActive.value && parent.draggedIndex.value === props.index) {
// 已经在拖拽中,处理拖拽移动
parent.onDragMove(touch)
return
}
// 如果没有开始拖拽,检查是否需要取消长按定时器
const movedDistance = getDistance(touch.clientX, touch.clientY, touchStartPosition.x, touchStartPosition.y)
// 如果设置了长按延迟
if (parent.props.longPressDuration > 0) {
if (longPressTimer) {
// 还没到长按时间,移动超过阈值就取消长按
if (movedDistance > 15) {
clearTimeout(longPressTimer)
longPressTimer = null
// 这里返回,允许页面滚动
return
}
}
}
}
/**
* 触摸结束/取消处理
*/
const onTouchEnd = () => {
if (longPressTimer) {
clearTimeout(longPressTimer)
longPressTimer = null
}
if (isDraggingActive.value) {
isDraggingActive.value = false
if (parent) parent.onDragEnd()
const onTouchStart = (e: any) => {
// 如果事件已经被 handle 处理过,则忽略
if (e.__handledByHandle) return
// 如果开启了 useDragHandle,但不是由 handle 触发的,则忽略
if (parent && parent.props.useDragHandle && !isHandleTriggered) {
return
}
// 重置标志位
isHandleTriggered = false
startDragLogic(e)
}
/**
* 供 Slot 使用的 Handle TouchStart
*/
const onHandleTouch = (e: any) => {
if (parent && parent.props.useDragHandle) {
isHandleTriggered = true
startDragLogic(e)
// 阻止 Root 再次响应(如果冒泡的话)
// 给 event 对象加个标记
e.__handledByHandle = true
}
}
/**
* 触摸移动处理
*/
const handleTouchMove = (e: any) => {
if (!parent) return
// 阻止冒泡,避免嵌套问题
if (e.stopPropagation) {
e.stopPropagation()
}
// 如果正在拖拽,阻止默认行为(滚动)
if (isDraggingActive.value && e.preventDefault) {
e.preventDefault()
}
const touch = getTouch(e)
// 检查是否已经开始拖拽
if (isDraggingActive.value && parent.draggedIndex.value === props.index) {
// 已经在拖拽中,处理拖拽移动
parent.onDragMove(touch)
return
}
// 如果没有开始拖拽,检查是否需要取消长按定时器
const movedDistance = getDistance(touch.clientX, touch.clientY, touchStartPosition.x, touchStartPosition.y)
// 如果设置了长按延迟
if (parent.props.longPressDuration > 0) {
if (longPressTimer) {
// 还没到长按时间,移动超过阈值就取消长按
if (movedDistance > 15) {
clearTimeout(longPressTimer)
longPressTimer = null
// 这里返回,允许页面滚动
return
}
}
}
}
/**
* 触摸结束/取消处理
*/
const onTouchEnd = () => {
if (longPressTimer) {
clearTimeout(longPressTimer)
longPressTimer = null
}
isHandleTriggered = false
if (isDraggingActive.value) {
isDraggingActive.value = false
if (parent) parent.onDragEnd()
🤖 Prompt for AI Agents
In
`@src/uni_modules/wot-design-uni/components/wd-drag-sort-item/wd-drag-sort-item.vue`
around lines 239 - 320, isHandleTriggered is left true after a handle-initiated
drag, causing later non-handle touches to bypass the useDragHandle check; reset
this flag when touch finishes or is cancelled. Modify onTouchEnd (and the
touch-cancel path if present) to set isHandleTriggered = false (and also
consider setting it false after calling startDragLogic inside onHandleTouch) so
that subsequent onTouchStart correctly enforces parent.props.useDragHandle;
update the functions onHandleTouch, onTouchStart, and onTouchEnd to ensure the
flag is cleared after drag start or end.

Comment on lines +164 to +169
Promise.all(promises).then((results) => {
// 过滤掉 null
const validRects = results.filter((r) => r)
handleLayout(containerRect, validRects)
resolve()
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

子项矩形部分缺失时会导致布局映射不完整。

validRects 数量小于 children.length,当前实现会继续布局,可能造成 items/slots 映射缺失,进而拖拽失效。建议在不完整时重试布局。

🛠️ 建议修复
     Promise.all(promises).then((results) => {
       // 过滤掉 null
       const validRects = results.filter((r) => r)
+      if (validRects.length < children.length) {
+        retryLayout()
+        resolve()
+        return
+      }
       handleLayout(containerRect, validRects)
       resolve()
     })
🤖 Prompt for AI Agents
In `@src/uni_modules/wot-design-uni/components/wd-drag-sort/wd-drag-sort.vue`
around lines 164 - 169, The layout mapping can be incomplete when some child
rects are null: in the Promise.all(promises).then(...) block check if
validRects.length < children.length and, if so, retry the measurement instead of
calling handleLayout; implement a bounded retry (e.g. re-enqueue the measurement
via setTimeout or re-run the promise collection up to a maxRetries counter) and
only call handleLayout(containerRect, validRects) and resolve() when
validRects.length === children.length (or reject/resolve with a clear fallback
after maxRetries) to ensure items/slots mapping remains consistent for drag
operations.

Comment on lines +322 to +333
// 组件销毁前清除定时器
onBeforeUnmount(() => {
uni.offWindowResize(onWindowResize)
stopAutoScroll()
if (updateTimer) {
clearTimeout(updateTimer)
updateTimer = null
}
if (silentTimer) {
clearTimeout(silentTimer)
silentTimer = null
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

卸载时需清理 initDebounceTimer,避免卸载后回调执行。

当前只清理了 updateTimer/silentTimer,initDebounceTimer 可能在卸载后触发 dragInit。

🧹 建议修复
   onBeforeUnmount(() => {
     uni.offWindowResize(onWindowResize)
     stopAutoScroll()
+    if (initDebounceTimer) {
+      clearTimeout(initDebounceTimer)
+      initDebounceTimer = null
+    }
     if (updateTimer) {
       clearTimeout(updateTimer)
       updateTimer = null
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 组件销毁前清除定时器
onBeforeUnmount(() => {
uni.offWindowResize(onWindowResize)
stopAutoScroll()
if (updateTimer) {
clearTimeout(updateTimer)
updateTimer = null
}
if (silentTimer) {
clearTimeout(silentTimer)
silentTimer = null
}
// 组件销毁前清除定时器
onBeforeUnmount(() => {
uni.offWindowResize(onWindowResize)
stopAutoScroll()
if (initDebounceTimer) {
clearTimeout(initDebounceTimer)
initDebounceTimer = null
}
if (updateTimer) {
clearTimeout(updateTimer)
updateTimer = null
}
if (silentTimer) {
clearTimeout(silentTimer)
silentTimer = null
}
🤖 Prompt for AI Agents
In `@src/uni_modules/wot-design-uni/components/wd-drag-sort/wd-drag-sort.vue`
around lines 322 - 333, The onBeforeUnmount cleanup omits initDebounceTimer so a
pending debounce can fire dragInit after unmount; in the onBeforeUnmount handler
(the one that currently clears updateTimer and silentTimer) also check for
initDebounceTimer, call clearTimeout(initDebounceTimer) and set
initDebounceTimer = null to fully cancel the pending debounce and prevent
dragInit from running post-unmount.

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 this pull request may close these issues.

1 participant