如何将 ListItem 变成链接?
我尝试用 achor 标签包装它,但没有用。 我在http://material-ui.com/#/components/lists 中没有看到属性
我遇到了相反的问题。 我希望它阻止它呈现为链接。 在 ListItem 中使用带有 MenuItems 的 IconMenu 时,出现嵌套链接错误。 虽然它在文档中工作,所以也许我做错了什么。
ListItem > EnhancedButton > a > ... > IconMenu > ReactTransitionGroup > Menu > MenuItem > ListItem > EnhancedButton > a。
有什么办法可以防止这种情况吗? 我知道这是一个与@sys13不同的问题,但它可能有相同的解决方案。
将containerElement
与linkButton
道具一起使用!
看:
http://stackoverflow.com/questions/32106513/material-ui-menu-using-routes/34507786#34507786
<MenuItem
linkButton
containerElement={<Link to="/profile" />}
primaryText="Profile"
leftIcon={
<FontIcon className="material-icons">people</FontIcon>
} />
或者,如果您不使用 react-router,只需使用
<MenuItem linkButton href="/profile" primaryText="Profile" />
这已在 #2708 中修复
最有用的评论
将
containerElement
与linkButton
道具一起使用!看:
http://stackoverflow.com/questions/32106513/material-ui-menu-using-routes/34507786#34507786
或者,如果您不使用 react-router,只需使用