1、使用 ES6 实现样式模块化,避免样式冲突
index.module.css
.title {
background: red;
}
Hello.jsx
import hello from './index.module.css'
export default class Hello extends Component {
render() {
return <h2 className={hello.title}>Hello</h2>
}
}
2、也可以使用 less 嵌套避免样式冲突
.hello {
.title {
background: red;
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)