Material-ui: 列表项链接?

创建于 2015-10-07  ·  3评论  ·  资料来源: mui-org/material-ui

如何将 ListItem 变成链接?

我尝试用 achor 标签包装它,但没有用。 我在http://material-ui.com/#/components/lists 中没有看到属性

最有用的评论

containerElementlinkButton道具一起使用!

看:
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" />

所有3条评论

我遇到了相反的问题。 我希望它阻止它呈现为链接。 在 ListItem 中使用带有 MenuItems 的 IconMenu 时,出现嵌套链接错误。 虽然它在文档中工作,所以也许我做错了什么。

ListItem > EnhancedButton > a > ... > IconMenu > ReactTransitionGroup > Menu > MenuItem > ListItem > EnhancedButton > a。

有什么办法可以防止这种情况吗? 我知道这是一个与@sys13不同的问题,但它可能有相同的解决方案。

containerElementlinkButton道具一起使用!

看:
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 中修复

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

activatedgeek picture activatedgeek  ·  3评论

anthony-dandrea picture anthony-dandrea  ·  3评论

newoga picture newoga  ·  3评论

ghost picture ghost  ·  3评论

ryanflorence picture ryanflorence  ·  3评论