【问题标题】:Tab tag material ui标签标签材质ui
【发布时间】:2020-10-18 18:56:20
【问题描述】:

不能在材质 ui 中的材质标签标签内使用链接标签 Tab 内的所有代码都不起作用

<Tabs>
             <Tab>
                 <Link
                     style={isActive(history, "/cart")}
                     to="/cart"
                >
                     Cart{" "}
                     <sup>
                         <small className="cart-badge">{itemTotal()}</small>
                     </sup>
                </Link>
             <Tab/>
<Tabs/>

【问题讨论】:

    标签: material-ui


    【解决方案1】:

    根据文档Tab 不支持children。相反,您可以使用 component 道具。

    https://material-ui.com/api/tab/#props

    <Tabs>
       <Tab
          component={() => (
              <Link
                 style={isActive(history, "/cart")}
                 to="/cart"
                 >
                  Cart{" "}
                  <sup>
                    <small className="cart-badge">{itemTotal()}</small>
                  </sup>
              </Link>
         )}/>
    </Tabs>
    

    【讨论】:

    • 你太棒了,谢谢你的回复,编码很好
    • @arminsali 如果您觉得我的回答对您有所帮助,请接受此作为正确答案。编码快乐!! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-01
    • 2018-12-09
    • 2019-04-11
    • 2020-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多