我有这段代码,我想要在选项卡上执行的操作是在图标上添加工具提示:
<Tabs.TabPane tab={<Tooltip placement="left" title="adasd"><Icon size="1.2" name="cog" /></Tooltip>} key="map">
<MapProperties onChange={onChange} canvasRef={canvasRef} />
</Tabs.TabPane>
Run Code Online (Sandbox Code Playgroud)
我期待悬停显示,但它不起作用。是否可以在选项卡窗格上添加 ant design 工具提示?
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}
>
Run Code Online (Sandbox Code Playgroud)
tab attribute accepts any ReactNode so we can just wrap our tab name with any component. And tooltip isn't exception.
| 归档时间: |
|
| 查看次数: |
2557 次 |
| 最近记录: |