react css 污染解决方法
上代码
.m-nav-bar {
background: #171a21;
.content {
height: 104px;
margin: 0px auto;
}
}
import React from "react";
import styles from './css.module.scss'
export default class NavBar extends React.Component<any, any> {
constructor (props: any) {
super(props);
this.state = {
};
}
render () {
return (
<div className={styles['m-nav-bar']}>
<div className={styles['content']}>
内容
</div>
</div>
);
}
}
导入的时候把名称改为
css.module.scss