Skip to content

fix(cascader): incorrect checked behavior when childNode is disabled #2131

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

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

Shabi-x
Copy link
Contributor

@Shabi-x Shabi-x commented Apr 30, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

原issue: Tencent/tdesign-vue#3579

💡 需求背景和解决方案

问题根源是
当前在判断节点选中状态(isChecked)时,没有过滤掉disabled的子节点,导致状态计算不准确。
企业微信截图_112f8a25-76a3-4189-b037-fbe55ea6493f
当子节点状态为disabled时,这里isChecked没有完全隔离disabled的节点,导致父节点始终被判定为checked状态,使得resValue(被选中的项)运算结果不正确
企业微信截图_5ce4e845-2986-4b1e-b613-91836d889713

📝 更新日志

具体改动:

  1. 在计算父节点选中状态时,增加对子节点disabled状态的过滤;
  2. 保证禁用节点的状态不会被用户操作意外改变
  • 本条 PR 不需要纳入 Changelog

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

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

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

@Shabi-x Shabi-x closed this Apr 30, 2025
@Shabi-x Shabi-x reopened this Apr 30, 2025
@Shabi-x Shabi-x changed the title Fix cascader unchecked item 3579 fix(cascader): incorrect checked behavior when childNode is disabled Apr 30, 2025
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