css - 速记模态内容不适用于 React Semantic UI 中的 HTML 标签
问题描述
如文档中所述,我们可以使用这种速记方法创建模态。但是,如果我在该部分中添加任何 HTML 标记,content
则不会保留原始样式。
例如:工作正常:
const ModalExampleShorthand = () => (
<Modal
trigger={<Button>Show Modal</Button>}
header='Reminder!'
content='Call Benjamin regarding the reports.'
actions={['Snooze', { key: 'done', content: 'Done', positive: true }]}
/>
)
不工作(内容部分样式消失):
const ModalExampleShorthand = () => (
<Modal
trigger={<Button>Show Modal</Button>}
header='Reminder!'
content={<p>Call Benjamin regarding the reports</p>}
actions={['Snooze', { key: 'done', content: 'Done', positive: true }]}
/>
)
您可以在此处的“试用”部分中对其进行编辑:
解决方案
这是一个常见的错误,很快就会在新的速记文档中介绍。
实际问题:当您传递一个 React 元素时,它将替换整个速记槽。
有效的用法是:
content={<Modal.Content>Call Benjamin regarding the reports.</Modal.Content>}
content={{ content: <p>Call Benjamin regarding the reports.</p> }}
推荐阅读
- java - 启动 Camera RuntimeException - android 相机 API
- windows - “ECHO 开启”在变量中设置
- java - 从 Android 上的 night 文件夹中获取颜色
- pandas - 如何根据另一列值的函数输出在df中插入值
- php - Apache,如何处理未知的 php 文件,如标准 URL?
- scala - Scala:函数参数 Int 或 Double,如何使其通用?
- sql - JOIN 使用透视数据提高性能
- firebase - 错误:尚未使用 react native 初始化 FacebookSDK
- swift - 在 SwiftUI 中隐藏导航栏而不会丢失向后滑动手势
- ruby - Ruby 时间比较混乱和混乱。一个无法解开的谜团