Skip to content

feat: 新增statistic 数值显示#489

Merged
Moonofweisheng merged 6 commits intoMoonofweisheng:masterfrom
PdxLook:statistic
Aug 8, 2024
Merged

feat: 新增statistic 数值显示#489
Moonofweisheng merged 6 commits intoMoonofweisheng:masterfrom
PdxLook:statistic

Conversation

@PdxLook
Copy link
Copy Markdown
Contributor

@PdxLook PdxLook commented Aug 3, 2024

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

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 新增统计组件的文档,提供详细的使用指南和示例。
    • 在导航中添加“Statistic 数值显示”页面,提升用户访问统计数据的便捷性。
    • 引入wd-statistic组件,以动态方式展示统计值,支持自定义属性和动画。
  • 样式

    • wd-statistic组件引入新的SCSS样式,确保一致的视觉效果。
  • 文档

    • 更新文档,增加有关统计组件的详细说明和用法示例。

@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 3, 2024

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit 85bef62
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/66b4170d7507fd00091c120e
😎 Deploy Preview https://deploy-preview-489--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 site configuration.

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 0:55am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 3, 2024

Walkthrough

此次更新为文档和组件引入了新的统计功能。新增的 wd-statistic 组件支持动态数据显示,并提供丰富的自定义选项。文档结构也进行了优化,以便用户更方便地访问和使用新组件,增强了整体用户体验和导航能力。

Changes

文件路径 更改摘要
docs/component/statistic.md 新增统计组件文档,详细介绍用法和属性。
src/pages/statistic/Index.vue 新增展示统计组件功能的示例页面,包含交互演示。
src/uni_modules/wot-design-uni/components/wd-statistic/wd-statistic.vue 新增 Vue 组件,实现动态统计值的动画显示。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant StatisticComponent
    participant AnimationHandler

    User->>StatisticComponent: 初始化组件
    StatisticComponent-->>User: 显示默认统计值
    User->>StatisticComponent: 修改统计值
    StatisticComponent->>AnimationHandler: 启动动画
    AnimationHandler-->>StatisticComponent: 动画完成
    StatisticComponent-->>User: 显示更新后的统计值
Loading

Poem

🐇 在数字舞动中,统计显生辉,
组件新生,用户赞美飞。
自定义选项,样式统一,
兔子欢跃,乐在其中哟!
动态展示,数值如歌,
技术之美,尽在此刻。 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to 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.yaml file 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.

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: 2

Outside diff range, codebase verification and nitpick comments (6)
docs/component/statistic.md (3)

10-12: 确保示例代码的正确性

建议在示例代码中添加一个描述,以便用户更好地理解代码的功能。

+```vue
+<!-- 显示2024年的统计数值 -->
 <wd-statistic :endVal="2024" suffix="年" color="#16baaa"></wd-statistic>

---

`17-21`: **确保示例代码的正确性**

建议在示例代码中添加描述,以便用户更好地理解代码的功能。

```diff
+```vue
+<!-- 使用插槽自定义前缀和后缀 -->
 <wd-statistic prefix="¥" :startVal="0" :decimals="2" :endVal="186.321" :fontSize="32" suffix="%" color="#1e9fff"></wd-statistic>
 <wd-statistic prefix="¥" :startVal="0" :decimals="2" :endVal="21286.321" :fontSize="32" suffix="%" color="#ff5722"></wd-statistic>
 <wd-statistic prefix="¥" :startVal="0" :decimals="2" :endVal="21286.321" :fontSize="32" suffix="%" color="#ffb800" :duration="2000"></wd-statistic>

---

`27-29`: **确保示例代码的正确性**

建议在示例代码中添加描述,以便用户更好地理解代码的功能。

```diff
+```html
+<!-- 自定义字体颜色 -->
 <wd-statistic :endVal="2024" color="#16baaa"></wd-statistic>

</blockquote></details>
<details>
<summary>src/uni_modules/wot-design-uni/components/wd-statistic/wd-statistic.vue (3)</summary><blockquote>

`1-16`: **确保插槽的正确性**

建议为每个插槽添加默认内容,以便在没有提供插槽内容时显示默认值。

```diff
 <slot name="prefix">
   <wd-text :color="props.color" :size="`${props.fontSize * 0.7}px`" :text="props.prefix"></wd-text>
 </slot>
 <slot name="default">
   <wd-text :color="props.color" :size="`${props.fontSize}px`" :text="displayValue"></wd-text>
 </slot>
 <slot name="suffix">
   <wd-text :color="props.color" :size="`${props.fontSize * 0.7}px`" :text="props.suffix"></wd-text>
 </slot>

18-26: 确保组件选项的正确性

建议为组件添加更多选项说明,以便用户更好地理解组件的功能。

 export default {
   name: 'wd-statistic',
   options: {
     virtualHost: true,
     addGlobalClass: true,
     styleIsolation: 'shared' // 共享样式隔离
   }
 }

214-216: 确保样式的正确性

建议在样式中添加注释,以便用户更好地理解样式的作用。

 @import './index.scss'; // 导入组件样式
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 108e1b3 and 7384aa6.

Files selected for processing (9)
  • docs/.vitepress/config.mts (1 hunks)
  • docs/component/statistic.md (1 hunks)
  • src/pages.json (1 hunks)
  • src/pages/index/Index.vue (1 hunks)
  • src/pages/statistic/Index.vue (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-statistic/index.scss (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-statistic/requestAnimationFrame.ts (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-statistic/types.ts (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-statistic/wd-statistic.vue (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/uni_modules/wot-design-uni/components/wd-statistic/index.scss
Additional context used
Markdownlint
docs/component/statistic.md

37-37: Column: 14
Hard tabs

(MD010, no-hard-tabs)


37-37: Column: 22
Hard tabs

(MD010, no-hard-tabs)


37-37: Column: 25
Hard tabs

(MD010, no-hard-tabs)


37-37: Column: 30
Hard tabs

(MD010, no-hard-tabs)

Additional comments not posted (15)
src/uni_modules/wot-design-uni/components/wd-statistic/requestAnimationFrame.ts (4)

1-6: 变量声明和初始化正确

这些变量和常量的声明和初始化是正确的。


7-23: 浏览器前缀处理逻辑正确

代码正确处理了不同浏览器的前缀,并尝试获取兼容的 requestAnimationFramecancelAnimationFrame 实现。


24-41: 回退实现正确

如果浏览器不支持 requestAnimationFrame,代码提供了使用 setTimeout 的回退实现,这是正确的。


43-43: 导出语句正确

导出 requestAnimationFramecancelAnimationFrame 函数的语句是正确的。

src/pages/statistic/Index.vue (4)

1-6: 模板语法正确

模板语法正确,wd-statistic 组件的使用方式也很恰当。


7-20: 插槽使用正确

模板语法正确,wd-statistic 组件的插槽使用方式也很恰当。


22-46: ref 方法使用正确

模板语法正确,wd-statistic 组件的 ref 方法使用方式也很恰当。


47-57: 脚本逻辑正确

脚本语法正确,组件逻辑也很恰当。

src/uni_modules/wot-design-uni/components/wd-statistic/types.ts (4)

1-6: 导入和基础属性定义正确

导入语句和基础属性的定义是正确的。


7-54: 属性定义正确

各个属性的定义是正确的,并且遵循了最佳实践。


56-107: 附加属性定义和导出语句正确

附加属性的定义和导出语句是正确的。


109-109: 导出语句正确

导出 TextProps 类型的语句是正确的。

docs/.vitepress/config.mts (1)

369-370: 确保导航链接的正确性

建议检查新添加的导航链接是否正确,并确保其与现有结构一致。

src/pages.json (1)

746-754: 新增的统计页面配置项

新增的统计页面配置项格式正确,路径、名称和样式属性都与其他页面保持一致。

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

290-292: 新增的统计组件项

新增的统计组件项格式正确,ID和名称属性都与其他组件保持一致。

Comment thread docs/component/statistic.md Outdated
Comment thread docs/component/statistic.md Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7384aa6 and 033493f.

Files selected for processing (1)
  • docs/component/statistic.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • docs/component/statistic.md

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 033493f and 4f3ad4a.

Files selected for processing (3)
  • docs/component/statistic.md (1 hunks)
  • src/pages/statistic/Index.vue (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-statistic/wd-statistic.vue (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • docs/component/statistic.md
  • src/pages/statistic/Index.vue
  • src/uni_modules/wot-design-uni/components/wd-statistic/wd-statistic.vue

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4f3ad4a and 85bef62.

Files selected for processing (1)
  • docs/component/statistic.md (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • docs/component/statistic.md

@Moonofweisheng Moonofweisheng merged commit 592c37b into Moonofweisheng:master Aug 8, 2024
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.

2 participants