Skip to content

Conversation

@GreatAuk
Copy link

@GreatAuk GreatAuk commented Nov 6, 2025

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

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

🔗 相关 Issue

💡 需求背景和解决方案

感觉默认的 loading 图标不够精致,在手机上看有点糊

Screen-2025-11-06-171032.1.mp4

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

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

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

Summary by CodeRabbit

Summary by CodeRabbit

  • 新特性
    • 加载指示器新增 spinner 类型;可选类型扩展为 ring(默认)、outline、spinner,提供更多动画风格和示例展示
  • 文档
    • 更新使用说明、参数表和示例,移除过时描述并补充 spinner 示例
  • 样式
    • 新增可配置的加载动画时长变量,动画时长可自定义
  • 本地化
    • 增加 spinner 类型的中英文文案项
  • 测试
    • 新增 spinner 类型的单元测试覆盖

@vercel
Copy link

vercel bot commented Nov 6, 2025

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

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Nov 6, 2025

Deploy Preview for wot-design-uni ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 0f99280
🔍 Latest deploy log https://app.netlify.com/projects/wot-design-uni/deploys/690d49ca7fe4fe00085950c0
😎 Deploy Preview https://deploy-preview-1359--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.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

向加载组件新增 "spinner" 类型选项,完整支持三种类型:ring(默认)、outlinespinner;相关类型定义、组件实现、样式变量、文档、中英本地化、演示页面与单元测试均已同步更新。

Changes

Cohort / File(s) 变更摘要
文档(中文)
docs/component/loading.md
扩展 type 可选项为 ring / outline / spinner,更新示例与参数表。
文档(英文)
docs/en-US/component/loading.md
同步扩展 type 可选项并新增 spinner 示例,调整示例文本与外部类表格格式。
本地化
src/locale/en-US.json, src/locale/zh-CN.json
新增翻译项 spinner-lie-xing(英文: "spinner type",中文: "spinner 类型")。
类型定义
src/uni_modules/wot-design-uni/components/wd-loading/types.ts
扩展 LoadingType 联合类型:加入 'spinner'
组件实现
src/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vue
引入 LoadingType 类型、实现类型化的 SVG 生成器映射(icon),新增 currentType 默认为 'ring',根据类型构建并 base64 编码 SVG 数据 URL。
样式变量 & 样式
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss, src/uni_modules/wot-design-uni/components/wd-loading/index.scss
新增 SCSS 变量 $-loading-duration 并在动画声明中使用以替代硬编码时长(wd-rotate $-loading-duration)。
演示页面
src/subPages/loading/Index.vue
新增 spinner 演示区、颜色示例与不同尺寸展示,添加 .my-4 辅助类与相应样式。
测试
tests/components/wd-loading.test.ts
新增针对 type="spinner" 的单元测试,断言 SVG 渲染存在。

Sequence Diagram(s)

sequenceDiagram
  participant App as 使用方
  participant WdLoading as WdLoading 组件
  participant IconMap as icon 映射

  Note over App,WdLoading `#D6EAF8`: 渲染阶段(选择 type)
  App->>WdLoading: 传入 props (type, color, size)
  WdLoading->>WdLoading: 确定 currentType = isDef(type) ? type : "ring"
  WdLoading->>IconMap: 请求对应 SVG 生成函数 (currentType, color, intermediateColor?)
  IconMap-->>WdLoading: 返回 SVG 字符串
  WdLoading->>WdLoading: base64 编码 SVG,构建 data URL
  WdLoading-->>App: 渲染带有 data URL 的 `<svg>` / 背景图片
Loading

估算审查工作量

🎯 3 (中等复杂) | ⏱️ ~20 分钟

需要额外关注的点:

  • src/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vueicon 映射中各类型 SVG 的正确性与参数(color / intermediateColor)处理与 base64 构造。
  • types.tsLoadingType 导出与组件引入是否一致。
  • 样式变量:$-loading-duration 的作用域与覆盖优先级。
  • 演示与测试:Index.vue 的展示用例与新增测试是否覆盖关键渲染路径。

Poem

🐰 轻步绕草新姿态,
三色转环共鸣开,
ring 与 outline 伴 spinner,
小光点点暖我怀,
草间鼓掌为你来 🌿✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题清晰准确地描述了本次变更的核心内容:为loading组件新增spinner类型,与代码变更的主要目标完全一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae17c2c and 0f99280.

📒 Files selected for processing (2)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-loading/index.scss (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ESLint Check
🔇 Additional comments (1)
src/uni_modules/wot-design-uni/components/wd-loading/index.scss (1)

15-15: ✅ 前次问题已修复:移除了冗余的 animation-duration 覆盖

第 15 行改为仅使用简写属性 animation: wd-rotate $-loading-duration linear infinite;,移除了之前第 16 行的 animation-duration: 2s; 覆盖声明。这解决了变量失效的问题,使得动画时长声明现在保持一致。


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.

Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 310df13 and ae17c2c.

📒 Files selected for processing (2)
  • src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-loading/index.scss (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Generate Test Summary
🔇 Additional comments (1)
src/uni_modules/wot-design-uni/components/common/abstracts/variable.scss (1)

662-662: 变量定义格式正确,但需验证在 index.scss 中的实际使用

变量定义遵循项目约定,提供了通过 CSS 自定义属性 --wot-loading-duration 的公开定制接口。不过,由于 src/uni_modules/wot-design-uni/components/wd-loading/index.scss 第 16 行的 animation-duration: 2s; 声明,这个变量在当前实现中并未真正生效。建议先修复 index.scss 中的级联覆盖问题,确保该变量在所有 loading 类型中都能正确使用。

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