feat: components used in confirm title and content support prefixCls #27376
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.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
Background:
Modal.config
中 设置的rootPrefixCls
, 只会作用于Modal.confirm
中的Modal
组件部分,而不会作用于Modal
接收的antd子组件,如title
和content
。因为title
和content
的类型是ReactNode
,可以接收antd组件,在全局设置prefixCls
后,会导致这部分组件样式丢失,目前解决方式只能在每个使用的地方都加上prefixCls
。Solution:
Modal.confirm
内部形成一个context
,复用ConfigProvider
,将Modal.config
中 设置的rootPrefixCls
传给内部ConfigProvider
。📝 Changelog
rootPrefixCls
set inModal.config
can be effective for the antd components used intitle
andcontent
Modal.config
中设置的rootPrefixCls
可以对title
和content
下使用的antd组件生效☑️ Self Check before Merge