reactjs - 如何在蚂蚁设计选项卡上添加工具提示?
问题描述
我有这段代码,我想在标签道具上做的是在图标上添加工具提示:
<Tabs.TabPane tab={<Tooltip placement="left" title="adasd"><Icon size="1.2" name="cog" /></Tooltip>} key="map">
<MapProperties onChange={onChange} canvasRef={canvasRef} />
</Tabs.TabPane>
我期待悬停显示,但它不工作。是否可以在选项卡窗格上添加 ant 设计工具提示?
解决方案
Anuj's answer isn't correct since TabPane should be direct children of Tabs component. I also had such problem and I find out that i can solve it like this:
<TabPane
key="3"
tab={(
<Tooltip title="Your hint that appears after user's mouse will be over the tab title">
<span>tab title</span>
</Tooltip>
)}
disabled={mode === PageMode.NEW}
>
tab attribute accepts any ReactNode so we can just wrap our tab name with any component. And tooltip isn't exception.
推荐阅读
- javascript - 在JS中获取具有唯一值的数组的最简单方法是什么?
- javascript - 关闭对话框数据源后使用对话框结果更新:[object Object]
- java - 无法在 apache maven IntelliJ Idea 中执行目标
- r - 让 RowReorder 扩展在闪亮的 DataTable 中工作
- android - Android 11 中的位置信息访问
- javascript - 在特定列表项中显示按钮 - 反应 - antd
- javascript - 如何从 Dart 调用 Javascript 代码并在控制台中注册回调?
- c++ - 访问类 QList Pointer 的成员
- javascript - Vuejs - 在样式模板中使用变量作为背景图像
- server - Firebase 云按摩 - 推送通知服务器密钥句柄