From 2b3878549aed45961669f1e81d3dac9c4881df27 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 25 Nov 2015 11:34:55 +0800 Subject: [PATCH] docs: update Slider docs for `tipFormatter` --- components/slider/demo/tip-formatter.md | 18 ++++++++++++++++++ components/slider/index.md | 1 + 2 files changed, 19 insertions(+) create mode 100644 components/slider/demo/tip-formatter.md diff --git a/components/slider/demo/tip-formatter.md b/components/slider/demo/tip-formatter.md new file mode 100644 index 0000000000..99b0744f7c --- /dev/null +++ b/components/slider/demo/tip-formatter.md @@ -0,0 +1,18 @@ +# 格式化 `Tooltip` 内容 + +- order: 5 + +使用 `tipFormatter` 可以格式化 `Tooltip` 的内容。 + +--- + +````jsx +import { Slider } from 'antd'; + +function formatter(value) { + return '$' + value; +} + +ReactDOM.render( +, document.getElementById('components-slider-demo-tip-formatter')); +```` diff --git a/components/slider/index.md b/components/slider/index.md index 85df4e55ef..5f5f63e519 100644 --- a/components/slider/index.md +++ b/components/slider/index.md @@ -25,3 +25,4 @@ | included | Boolean | true | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | disabled | Boolean | false | 值为 `true` 时,滑块为禁用状态 | onChange | Function | NOOP | 当 Slider 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入。 +| tipFormatter | Function | | Slider 会把当前值传给 `tipFormatter`,并在 Tooltip 中显示 `tipFormatter` 的返回值。