Radium与之反应路由器IndexLink
组件不起作用。我使用FAQ's method但这并不能解决问题。镭不与工作做出反应路由器IndexLink组件
这里是我的代码:
import React, {PropTypes} from 'react';
import {IndexLink} from 'react-router';
import {deepPurple500, deepPurple300, grey600} from 'material-ui/styles/colors';
import radium from 'radium';
import {default as rem} from 'helpers/calculateRem';
const DecoratedIndexLink = radium(IndexLink);
/**
* Link component.
*
* @param {Object} style
* @param {String} to
* @param {String} label
* @param {Boolean} secondary
*/
function Link({style, to, label, secondary}) {
const defaultStyle = {
textDecoration: 'none',
color: secondary ? grey600 : deepPurple500,
borderBottomWidth: rem(1),
borderBottomStyle: 'solid',
borderColor: secondary ? grey600 : deepPurple500,
':hover': {
color: deepPurple300
}
};
return <DecoratedIndexLink style={{...style, ...defaultStyle}} to={to}>{label}</DecoratedIndexLink>;
}
Link.prototype.propTypes = {
style: PropTypes.obj,
to: PropTypes.string,
label: PropTypes.string,
secondary: PropTypes.bool
};
export default radium(Link);
我装点export default
与镭,但有或没有也没什么变化。我甚至试图用button
之类的DOM元素及其作品代替IndexLink
,所以我想它完全与自定义组件有关。
对此案件的任何提示?
谢谢。
谢谢!这符合预期。 –