Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs MenuItem组件的材质ui颜色?_Reactjs_Menu_Menuitem_Material Ui - Fatal编程技术网

Reactjs MenuItem组件的材质ui颜色?

Reactjs MenuItem组件的材质ui颜色?,reactjs,menu,menuitem,material-ui,Reactjs,Menu,Menuitem,Material Ui,我读过: 及 但似乎找不到我要找的答案。我只是想改变悬停物品的颜色。我认为,通过查看这些文档,我应该只参考menuItem,并提供一个hoverColor,尽管这不起作用。有什么想法吗 (不要介意内联css覆盖,只是尝试不同的操作方式。) 应用程序 类应用程序扩展组件{ 建造师(道具){ 超级(道具); injectTapEventPlugin(); } render(){ 返回( ); } } 导航 类导航扩展组件{ 建造师(道具){ 超级(道具); } render(){ 返回( );

我读过:

但似乎找不到我要找的答案。我只是想改变悬停物品的颜色。我认为,通过查看这些文档,我应该只参考
menuItem
,并提供一个
hoverColor
,尽管这不起作用。有什么想法吗

(不要介意内联css覆盖,只是尝试不同的操作方式。)

应用程序

类应用程序扩展组件{
建造师(道具){
超级(道具);
injectTapEventPlugin();
}
render(){
返回(
);
}
}
导航

类导航扩展组件{
建造师(道具){
超级(道具);
}
render(){
返回(
);
}
}

您可以执行以下操作

<Drawer containerStyle={style.nav}>
    <Menu>
      <MenuItem
        style={{...style.navItem, borderLeft: '2px solid #38a9e3' }}
        onMouseEnter={(e) => e.target.style.color = '#495054'}
        onMouseLeave={(e) => e.target.style.color = '#ffffff'}
        primaryText="Home"
        containerElement={<NavLink activeStyle={{color:'#53acff'}} to='/home'></NavLink>} />
    </Menu>
  </Drawer>

e、 target.style.color='#495054'}
onMouseLeave={(e)=>e.target.style.color='#ffffff'}
primaryText=“主页”
containerElement={}/>
class Nav extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return(
      <Drawer containerStyle={style.nav}>
        <Menu>
          <MenuItem
            style={{...style.navItem, borderLeft: '2px solid #38a9e3', hoverColor: '#495054' }}
            primaryText="Home"
            containerElement={<NavLink activeStyle={{color:'#53acff'}} to='/home'></NavLink>} />
        </Menu>
      </Drawer>
    );
  }
}
<Drawer containerStyle={style.nav}>
    <Menu>
      <MenuItem
        style={{...style.navItem, borderLeft: '2px solid #38a9e3' }}
        onMouseEnter={(e) => e.target.style.color = '#495054'}
        onMouseLeave={(e) => e.target.style.color = '#ffffff'}
        primaryText="Home"
        containerElement={<NavLink activeStyle={{color:'#53acff'}} to='/home'></NavLink>} />
    </Menu>
  </Drawer>