- has the following react components:
import "./Home.scss";
class Home extends React.Component{
render(){
return (
<div className="box clearfix">
<div className="left">
<Echart style={{width: "100%", height: 300}} .../>
</div>
<div className="right">
<Echart style={{width: "100%", height: 300}} .../>
</div>
</div>
);
}
}
.left
, .right
each 50%
, but the width of the Echarts is indeed 100%
when rendering. If I write the style in the line, there will be no problem
//Home.scss
.box{
.left, .right{
width: "50%";
float: left;
}
}
so it seems that the style is not loaded when rendering Echarts, so at the beginning, the width of both left and right is 100%. How to solve this problem?