如何在活动时将“组件”传递到选项卡面板?

发布于 2025-01-19 17:58:12 字数 266 浏览 3 评论 0原文

请向我解释如何在antd库中活动时将组件传递到选项卡面板中?示例组件productshoe,

<Tabs defaultActiveKey="1">
      <TabPane tab="productshoe" key="productshoe">
          <Productshoe/>
      </TabPane>

但会导致错误

Please explain to me how to pass component into tab panel when active in antd library? Example component Productshoe

<Tabs defaultActiveKey="1">
      <TabPane tab="productshoe" key="productshoe">
          <Productshoe/>
      </TabPane>

but it makes error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

划一舟意中人 2025-01-26 17:58:12

您在 TabPane 中的 key 与父 Tabs 的键不匹配。尽量保持键值相同。如果添加更多选项卡,请保持键值唯一。
参考:链接

  <Tabs defaultActiveKey="productshoe" onChange={callback}>
    <TabPane tab="Tab 1" key="productshoe">
      <Productshoe/>
    </TabPane>
  </Tabs>

Your key in TabPane doesn't match with the key of parent Tabs. Try to keep the key value same. And keep key values unique if you add more tabs.
Reference: Link

  <Tabs defaultActiveKey="productshoe" onChange={callback}>
    <TabPane tab="Tab 1" key="productshoe">
      <Productshoe/>
    </TabPane>
  </Tabs>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文