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/cascader #1175

Closed
wants to merge 3 commits into from
Closed

Fix/cascader #1175

wants to merge 3 commits into from

Conversation

CodingOnStar
Copy link
Contributor

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

相关Issue

💡 需求背景和解决方案

1、Cascader使用input组件实现,当multiple属性为true时,会渲染一个新的span组件,内容为placeholder,此次commit为#229,目的是用于获取input组件的placeholder宽度。但在useEffect执行时,rerender未完成时,useRef获取DOM失败,因此width宽度为0,导致input的placeholder像是被挡住了。因此,等待rerender完成再获得useRef即可。
2.解决办法:1、setTimeout,此方法受性能影响,不够稳定;2、赋值useState
截屏2022-07-26 20 31 59

📝 更新日志

等待useEffect的rerender完成时,获取useRef的引用

  • fix(组件名称): 处理问题或特性描述 ...

  • 本条 PR 不需要纳入 Changelog

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

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

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

@honkinglin
Copy link
Collaborator

multiple 不展示 placeholder 问题已经在这个 pr 处理了 #1170

@honkinglin honkinglin closed this Jul 28, 2022
@CodingOnStar CodingOnStar deleted the fix/Cascader branch July 28, 2022 02:01
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