覆盖css类/自定义react-bootstrap组件的最佳方法是什么? – (我已经阅读过文档,除非我遗漏了一些内容,否则不予考虑).
从我所看到的,它似乎是内联样式(镭)和CSS模块之间的选择,但哪个更好,为什么?
我不确定这是否能回答您的问题,但
Documentation明确提供了示例.例如
Button
道具
+--------+---------+--------+--------------------------------------------+ | Name | Type | Default| Description | +--------+---------+--------+--------------------------------------------+ |bsClass | string | 'btn' | Base CSS class and prefix for the component| +--------+---------+--------+--------------------------------------------+
可以修改此选项以将自定义CSS类添加到Button组件.也可以通过设置componentClass来更改组件.
<Button type="submit" onClick={this.submit} bsClass='custom-class' > </Button>
custom-class是CSS类,可以
provide new,non-Bootstrap,CSS styles for a component.
Fiddle以及如何使用bsClass的示例.
内联样式:
根据bug填充,内联样式将不会正式支持.
you want to use the actual style prop. bsClass is for adjusting the
way bootstrap css classes are applied to the components not inline
styles
但issue指出:
You’re free to use them if you want. We have no formal opinion.
注意并非react-bootstrap提供的所有组件都允许通过bsClass进行类自定义,例如Breadcrumb
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。