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: form表单新增errorType错误提示类型 #487

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

PdxLook
Copy link
Contributor

@PdxLook PdxLook commented Aug 3, 2024

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

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新特性

    • 表单组件新增 errorType 属性,允许选择错误消息的显示方式(如消息、吐司通知或不显示)。
    • 改进的错误处理机制,提供更灵活的用户反馈选项。
  • 文档更新

    • 更新表单组件文档,包含新属性的详细描述和实现示例。

Copy link

netlify bot commented Aug 3, 2024

Deploy Preview for wot-design-uni ready!

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

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:53am

Copy link

coderabbitai bot commented Aug 3, 2024

Walkthrough

此次更改显著增强了表单组件的错误处理机制。引入了新的 errorType 属性,允许开发者选择三种错误显示方式(messagetoastnone),从而提升用户体验。文档和代码中的相关部分也进行了更新,以支持这一新特性并提供详细示例,使得表单的反馈更加灵活可定制。

Changes

文件路径 更改摘要
docs/component/form.md 新增 errorType 属性说明,支持不同的错误通知方式。
src/uni_modules/wot-design-uni/components/wd-form/types.ts formProps 中新增 errorType 属性,指定错误显示类型。
src/uni_modules/wot-design-uni/components/wd-form/wd-form.vue 修改表单组件,添加条件渲染以支持 toast 通知,优化错误消息处理。

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

@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 108e1b3 and d19a623.

Files selected for processing (3)
  • docs/component/form.md (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-form/types.ts (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-form/wd-form.vue (3 hunks)
Additional comments not posted (6)
src/uni_modules/wot-design-uni/components/wd-form/types.ts (1)

63-66: 新增的 errorType 属性

errorType 属性的实现看起来是正确的。使用 PropType 确保了类型安全,默认值为 message 适用于大多数使用场景。

请确保文档和代码示例中正确展示了该属性的用法。

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

4-4: 条件渲染 wd-toast 组件

wd-toast 组件的条件渲染实现看起来是正确的。它确保了只有在 errorTypetoast 时才会渲染该组件。


23-26: 导入和使用 useToast

useToast 函数的导入和使用看起来是正确的。确保 useToast 已正确定义并可用。


154-158: 更新 showMessage 函数

showMessage 函数的更新改进了错误处理机制,允许不同的错误显示方式。逻辑看起来是正确的,但请确保 toast.show 方法已正确定义并按预期行为工作。

docs/component/form.md (2)

88-93: 新增 errorType 属性的文档

文档清晰地描述了 errorType 属性及其可能的值。请确保示例相关且正确展示了 errorType 属性的用法。


97-154: errorType 属性的示例

示例相关且正确展示了 errorType 属性的用法。请确保示例完整并准确反映预期用法。

Copy link
Owner

@Moonofweisheng Moonofweisheng left a comment

Choose a reason for hiding this comment

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

在组件内部使用toast组件时,需要指定toastselector,防止因页面或同页面组件也使用toast导致重复提示的问题。

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d19a623 and d5b61aa.

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

Copy link
Owner

@Moonofweisheng Moonofweisheng left a comment

Choose a reason for hiding this comment

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

关于新API支持的版本,可以参考贡献指南,使用$LOWEST_VERSION$占位即可,发版时会自动更新。

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d5b61aa and ec968ef.

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

@Moonofweisheng Moonofweisheng merged commit 5915922 into Moonofweisheng:master Aug 8, 2024
6 checks passed
@PdxLook PdxLook deleted the form branch August 8, 2024 02:38
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