Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ DatetimePicker 支持自定义icon(#861) #872

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

810505339
Copy link
Collaborator

@810505339 810505339 commented Jan 25, 2025

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

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新特性

    • 日期时间选择器新增自定义图标功能
    • 支持自定义展示文案格式
    • 添加可清空的日期时间选择器
  • 文档更新

    • 新增自定义图标和展示文案的使用说明
  • 功能增强

    • 图标可根据选择器状态动态变化
    • 支持通过点击图标清空已选择的值

Copy link

vercel bot commented Jan 25, 2025

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 Jan 25, 2025 3:28pm

Copy link

coderabbitai bot commented Jan 25, 2025

变更概览

演练

这个拉取请求主要增强了日期时间选择器组件的自定义能力。文档中新增了两个部分:自定义图标和自定义展示文案。在示例页面中,添加了一个可清空的日期时间选择器,通过计算属性和方法实现了图标的动态渲染和清空功能。组件本身也进行了修改,使图标渲染更加灵活。

变更

文件 变更概要
docs/component/datetime-picker.md 新增"自定义icon"和"自定义展示文案"两个文档章节
src/pages/datetimePicker/Index.vue 添加可清空日期时间选择器的演示,引入value18iconNameclear方法
src/uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue 修改图标渲染方式,使用插槽增加灵活性

可能相关的PR

建议的审阅者

  • Moonofweisheng

诗歌

🐰 时间选择器,灵动如兔跃
图标随心换,文案任意写
清空键轻点,自由随风来
代码如诗行,创意不设防
兔子为你歌,定制无极限!


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

netlify bot commented Jan 25, 2025

Deploy Preview for wot-design-uni ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b850c8a
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/679502c4a2619c000839afa3
😎 Deploy Preview https://deploy-preview-872--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.

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

🧹 Nitpick comments (3)
src/pages/datetimePicker/Index.vue (1)

72-72: 建议优化清除功能的实现。

当前实现在清除时直接设置空字符串,建议考虑以下几点改进:

  1. 考虑添加清除前的确认机制
  2. 考虑触发 change 事件通知父组件

建议修改如下:

 const clear = () => {
   if (iconName.value === 'arrow-right') {
     return
   }
   value18.value = ''
+  emit('change', { value: '' })
 }

Also applies to: 77-87

docs/component/datetime-picker.md (2)

255-279: 文档示例完整,建议补充更多使用场景。

自定义图标的文档说明清晰,建议补充以下内容:

  1. 添加更多使用场景的示例,如不同状态下的图标展示
  2. 补充图标点击事件的防抖处理建议

371-371: API 文档完善,建议优化参数说明。

插槽参数说明简洁明了,建议补充:

  1. 详细的类型定义说明
  2. 更多的使用示例链接
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccf976a and b850c8a.

📒 Files selected for processing (3)
  • docs/component/datetime-picker.md (2 hunks)
  • src/pages/datetimePicker/Index.vue (3 hunks)
  • src/uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue (1 hunks)
🔇 Additional comments (2)
src/pages/datetimePicker/Index.vue (1)

36-42: 代码结构清晰,实现了可清空的日期时间选择器。

组件结构合理,通过插槽实现了自定义图标功能。

src/uni_modules/wot-design-uni/components/wd-datetime-picker/wd-datetime-picker.vue (1)

41-43: 插槽实现灵活,保持了良好的向后兼容性。

通过默认插槽内容保证了未使用自定义图标时的默认行为,同时向插槽传递了必要的状态属性。

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