Closed happypeter closed 7 years ago
好的
Radium 可以在 meteor v1.2.1 中使用,直接安装 Radium 的 npm 模块,使用的时候要把组件用 Radium() 方法包裹起来,如下:
TestRadium = Radium(React.createClass({
render() {
let styles = {
a: {
display: 'block',
textDecoration: 'none',
color: 'gray',
':hover': {color: 'red'}
}
};
return (
<a href='/' style={styles.a}>test radium</a>
)
},
}));
测试结果是 Radium 所扩展的功能 :hover
等等,只适用于自定义的组件。若在第三方组件中使用,Radium 的特殊功能就不生效了,需要第三方组件自己支持 Radium 才行。好消息是,material-ui 项目将会采用 Radium 处理组件的 inline style,而抛弃他们自己的方案,相关讨论参考 MUI 的 issue
不过,看来咱们走在正确的方向上
Radium 咱们可以稍微用一点,有坑的地方暂时还可以继续用老方法
嗯,Radium 对 react-router 的 Link 组件不起作用,不过有解决方案,
const Link = Radium(ReactRouter.Link)
这样,Radium 就生效了。参考 Radium 的 FAQ
https://github.com/FormidableLabs/radium/tree/master/docs/faq
帅,Radium 知识我都会总结到课程中的
目的是要实现收费,课程售卖等功能。把 haoqicat.com 的课程搬过来。