2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-11-25 15:34:25 +08:00
|
|
|
order: 3
|
2016-09-01 18:12:12 +08:00
|
|
|
title:
|
2016-07-21 09:51:04 +08:00
|
|
|
zh-CN: 自定义提示
|
2018-04-11 15:49:12 +08:00
|
|
|
en-US: Customize tooltip
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-11-25 11:34:55 +08:00
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2022-08-17 15:47:22 +08:00
|
|
|
使用 `tooltip.formatter` 可以格式化 `Tooltip` 的内容,设置 `tooltip.formatter={null}`,则隐藏 `Tooltip`。
|
2015-11-25 11:34:55 +08:00
|
|
|
|
2016-07-21 09:51:04 +08:00
|
|
|
## en-US
|
|
|
|
|
2022-08-17 15:47:22 +08:00
|
|
|
Use `tooltip.formatter` to format content of `Tooltip`. If `tooltip.formatter` is null, hide it.
|
2016-07-21 09:51:04 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2015-11-25 11:34:55 +08:00
|
|
|
import { Slider } from 'antd';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2015-11-25 11:34:55 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const formatter = (value: number) => `${value}%`;
|
2015-11-25 11:34:55 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-07-07 23:04:27 +08:00
|
|
|
<>
|
2022-08-17 15:47:22 +08:00
|
|
|
<Slider tooltip={{ formatter }} />
|
|
|
|
<Slider tooltip={{ formatter: null }} />
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2016-11-21 16:37:04 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|