问题描述
我正在尝试创建一个具有默认font-size( rem )的组件,并且该组件接受其他类作为道具。
问题是该组件具有默认的字体大小类:
.default-font{font-size: 1rem}
并且我想通过将类作为具有较小字体大小的props传递,但默认字体大小不允许,从而对组件进行更多控制。
组件:
<customComponent type="information" className="smaller-font">
<p>simple text</p>
</customComponent>
组件内的代码:
import cn from "classnames";
<div
className={cn(
"flex default-font justify-between",{
[className]: className
}
)}
>
<div>{children}</div>
</div>
CSS
.smaller-font:{font-size: .5rem}
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)