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

fix(input, textarea): 修改只读禁用属性设置逻辑 #3104

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

eiinu
Copy link
Member

@eiinu eiinu commented Jun 20, 2024

这个 PR 做了什么? (简要描述所做更改)

存在的问题:

当 Vue 版本 >= 3.4.28 时,Taro 小程序环境的 input 等标签中的 boolean 类型属性在设置为 false 时无效

理论上应该由 Taro 解决这一问题,不过我们可以提前做一些修改绕过它。

这个 PR 是什么类型? (至少选择一个)

  • feat: 新特性提交
  • fix: bug 修复
  • docs: 文档改进
  • style: 组件样式/交互改进
  • type: 类型定义更新
  • perf: 性能、包体积优化
  • refactor: 代码重构、代码风格优化
  • test: 测试用例
  • chore(deps): 依赖升级
  • chore(demo): 演示代码改进
  • chore(locale): 国际化改进
  • chore: 其他改动(是关于什么的改动?)

这个 PR 涉及以下平台:

  • NutUI H5 @nutui/nutui
  • NutUI Taro @nutui/nutui-taro

这个 PR 是否已自测:

Summary by CodeRabbit

  • Bug 修复
    • 修复 Vue 输入组件中的 disabledreadonly 属性处理问题,确保在特定条件下这些属性被正确设置为 undefined
    • 修复 Vue 文本区域组件中的 disabled 属性处理问题,确保在特定条件下该属性被正确设置为 undefined

Copy link

coderabbitai bot commented Jun 20, 2024

Warning

Rate limit exceeded

@eiinu has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 35 minutes and 30 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 1e6b6e3 and c826119.

Walkthrough

对多个 Vue 组件进行了统一的功能更新,包括新的条件逻辑绑定形式处理 disabledreadonly 属性。从直接绑定布尔值变为根据条件绑定布尔值或 undefined。这种改动确保了属性只有在有意义的时候才被应用,从而提高组件的可配置性和状态管理。

Changes

文件路径 更改摘要
src/packages/__VUE/input/input.taro.vue 更新 :disabled:readonly 属性的条件绑定逻辑
src/packages/__VUE/textarea/textarea.taro.vue 更新 :disabled 属性的条件绑定逻辑
src/packages/__VUE/inputnumber/input-number.vue 更新 :disabled:readonly 属性的条件绑定逻辑
src/packages/__VUE/searchbar/index.taro.vue 更新 :disabled:readonly 属性的条件绑定逻辑

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 Configration 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.

@eiinu eiinu changed the title fix(input): 修改只读禁用属性设置方式 fix: 修改表单元素只读禁用属性设置逻辑 Jun 20, 2024
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 e23b386 and 72bf5b0.

Files selected for processing (2)
  • src/packages/__VUE/input/input.taro.vue (1 hunks)
  • src/packages/__VUE/textarea/textarea.taro.vue (1 hunks)
Additional comments not posted (3)
src/packages/__VUE/textarea/textarea.taro.vue (1)

9-9: 此更改确保了在 Taro Vue 环境中,当 disabledreadonly 属性为假时,可以正确地不渲染这些属性。这是一个符合 Vue 条件绑定属性的最佳实践。

src/packages/__VUE/input/input.taro.vue (2)

17-17: 此更改确保了在 Taro Vue 环境中,当 disabled 属性为假时,可以正确地不渲染这个属性。这是一个符合 Vue 条件绑定属性的最佳实践。


18-18: 此更改确保了在 Taro Vue 环境中,当 readonly 属性为假时,可以正确地不渲染这个属性。这是一个符合 Vue 条件绑定属性的最佳实践。

@eiinu eiinu added the upstream 需要上游修复的,例如 Taro、各小程序平台等 label Jun 20, 2024
@eiinu
Copy link
Member Author

eiinu commented Jun 20, 2024

关联 issue:NervJS/taro#15946

@eiinu eiinu changed the title fix: 修改表单元素只读禁用属性设置逻辑 fix(input, textarea): 修改只读禁用属性设置逻辑 Jun 20, 2024
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.87%. Comparing base (487cf1f) to head (c826119).

Additional details and impacted files
@@            Coverage Diff             @@
##               v4    #3104      +/-   ##
==========================================
- Coverage   84.03%   83.87%   -0.16%     
==========================================
  Files         226      226              
  Lines       22939    22939              
  Branches     2482     2472      -10     
==========================================
- Hits        19276    19240      -36     
- Misses       3645     3681      +36     
  Partials       18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 72bf5b0 and 1e6b6e3.

Files selected for processing (2)
  • src/packages/__VUE/inputnumber/input-number.vue (1 hunks)
  • src/packages/__VUE/searchbar/index.taro.vue (1 hunks)
Additional comments not posted (2)
src/packages/__VUE/inputnumber/input-number.vue (1)

18-19: 这里的逻辑修改确保了在 Taro Vue 小程序环境中,当 disabledreadonly 属性为 false 时,这些属性不会被错误地应用。这种条件绑定的做法是一个有效的临时解决方案,直到 Taro 修复相关的问题。

src/packages/__VUE/searchbar/index.taro.vue (1)

20-21: 此代码段的修改与 input-number.vue 文件中的修改类似,通过条件表达式解决了 Taro Vue 小程序环境中 disabledreadonly 属性为 false 时的问题。这是对现有问题的有效临时修复。

@eiinu eiinu merged commit 5b82c8c into jdf2e:v4 Jun 20, 2024
5 of 6 checks passed
@eiinu eiinu deleted the fix-input branch June 20, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S upstream 需要上游修复的,例如 Taro、各小程序平台等
Projects
None yet
Development

Successfully merging this pull request may close these issues.

input 无法输入 好像一直是只读状态 input无法输入内容
1 participant