fix(menu): solve the problem of display being cropped by not enabling sliding in popup mode #2057 #2129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 这个 PR 的性质是?
🔗 相关 Issue
#2057
💡 需求背景和解决方案
@MingjieZhang @andyjxli
具体原因:
https://github.com/Tencent/tdesign-react/blob/develop/src/menu/Menu.tsx#L44 处判断设置 collapsed 时会添加 t-menu--scroll 样式,导致子组件无法溢出
解决方案1:
通过判断 expandType 是否为 popup 做为条件来判断是否添加 t-menu--scroll 样式。(Vue 那边就是这样处理的 相关代码 不过我觉得治标不治本,且会导致 menu 内容高度超过之后不可滑动)
方案1修复代码: PBK-B@6ce8d8e
解决方案2:
将 SubMenu 中的 popup 部分节点直接挂载到 body 上,或者在 SubMenu 中直接使用 Popup 组件(两种做法实际上是一样的解决思路),但是这样的话应该是需要在 tdesign-common 中修改 t-menu__popup 相关样式了,我下面的代码在 theme="dark" 情况下还是白色样式就是这样
方案2修复代码: PBK-B@0614e05
📝 更新日志
fix(menu): 修复 expandType 属性设置 popup 时样式异常问题
本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单