Javascript 镭内联CSS-基于构建导出类?
是否可以将所有内联镭样式提取到类中,这样html就不会因为所有内联样式而变得丑陋 我有这个:Javascript 镭内联CSS-基于构建导出类?,javascript,html,css,reactjs,radium,Javascript,Html,Css,Reactjs,Radium,是否可以将所有内联镭样式提取到类中,这样html就不会因为所有内联样式而变得丑陋 我有这个: @Radium class ExtendedComponent extends Component { render() { return ( <div style={[styles.color, styles.box]}</div> ); } } const styles = { color: { color: green },
@Radium
class ExtendedComponent extends Component {
render() {
return (
<div style={[styles.color, styles.box]}</div>
);
}
}
const styles = {
color: {
color: green
},
box: {
borderColor: red,
height: '20px',
width: '20px'
}
};
我不知道。就其本质而言,Radium用于动态计算和应用“内联”样式,并通过在JS中捆绑样式来利用React组件“模块” 反应风格 从下面链接中的列表中,这似乎可以满足您的需要。请参阅“在构建时将样式提取到CSS”一节- 备选库 这里有一个链接,指向一些可以满足您需求的备选方案:
<div style="color: green; border-color: red; height: 20px; width: 20px;"></div>
<div class="c1"></div>
.c1 {
color: green;
border-color: red;
height: 20px;
width: 20px;
}