升级到 v1 后,MenuItem containerElement 链接断开 material-ui
MenuItem containerElement Links broken after upgrading to v1 material-ui
旧菜单项因 react-router-dom
而损坏
<MenuItem
containerElement={<Link to="/module" />} >Module</MenuItem>
这停止工作....
如何升级这些新的菜单项控件以与 react-router 一起使用?
我试过用 root 替换 containerElement,也尝试用标签包围,但这样会使超链接带有下划线。我想保持与 MenuItem 相同的样式。
来自这个post:
从这里 demo.js 查看 https://codesandbox.io/s/5213wzkvpl
您可以使用 Link 作为 MenuItem 的子项:
<MenuList>
<MenuItem>
<Link to="/myRoute" style={{ textDecoration: 'none', display: 'flex' }}>
go to my route
</Link>
</MenuItem>
</MenuList>
旧菜单项因 react-router-dom
而损坏 <MenuItem
containerElement={<Link to="/module" />} >Module</MenuItem>
这停止工作....
如何升级这些新的菜单项控件以与 react-router 一起使用?
我试过用 root 替换 containerElement,也尝试用标签包围,但这样会使超链接带有下划线。我想保持与 MenuItem 相同的样式。
来自这个post:
从这里 demo.js 查看 https://codesandbox.io/s/5213wzkvpl
您可以使用 Link 作为 MenuItem 的子项:
<MenuList>
<MenuItem>
<Link to="/myRoute" style={{ textDecoration: 'none', display: 'flex' }}>
go to my route
</Link>
</MenuItem>
</MenuList>