这里是一个非常愚蠢的问题,我无法找到答案。
如何连接绑定的css模块类和全局类?
我有一个带有自己的CSS模块的组件,并将cx绑定到此导入:
import styles from '../styles/modules/break.module.scss'
let cx = classnames.bind(styles)
我需要写这样的东西:
<h1 className={(cx('highlight'), 'shout')}>
Content
</h1>
[其中.highlight
是break.module.scss
的类,而shout
是全局css表index.scss
的类。
谢谢!
您需要在shout
中添加cx
类。所有类都应在cx
函数内部传递,因为classnames
库采用了classnames
函数内部的所有类。
<h1 className={cx('highlight', 'shout')}>
Content
</h1>