Skip to content

Commit

Permalink
fix: slider marks support function #171
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined authored and tangjinzhou committed Sep 13, 2018
1 parent 647214c commit 2a26caa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/slider/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| disabled | If true, the slider will not be interactable. | boolean | false |
| dots | Whether the thumb can drag over tick only. | boolean | false |
| included | Make effect when `marks` not null,`true` means containment and `false` means coordinative | boolean | true |
| marks | Tick mark of Slider, type of key must be `number`, and must in closed interval [min, max] ,each mark can declare its own style. | object | { number: string\|VNode } or { number: { style: object, label: string\|VNode } } |
| marks | Tick mark of Slider, type of key must be `number`, and must in closed interval [min, max] ,each mark can declare its own style. | object | { number: string\|VNode } or { number: { style: object, label: string\|VNode } } or { number: () => VNode } |
| max | The maximum value the slider can slide to | number | 100 |
| min | The minimum value the slider can slide to. | number | 0 |
| range | dual thumb mode | boolean | false |
Expand Down
2 changes: 1 addition & 1 deletion components/slider/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| disabled | 值为 `true` 时,滑块为禁用状态 | boolean | false |
| dots | 是否只能拖拽到刻度上 | boolean | false |
| included | `marks` 不为空对象时有效,值为 true 时表示值为包含关系,false 表示并列 | boolean | true |
| marks | 刻度标记,key 的类型必须为 `number` 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式 | object | { number: string\|VNode } or { number: { style: object, label: string\|VNode } } |
| marks | 刻度标记,key 的类型必须为 `number` 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式 | object | { number: string\|VNode } or { number: { style: object, label: string\|VNode } } or { number: () => VNode } |
| max | 最大值 | number | 100 |
| min | 最小值 | number | 0 |
| range | 双滑块模式 | boolean | false |
Expand Down
4 changes: 2 additions & 2 deletions components/vc-slider/src/common/Marks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isValidElement } from '../../../_util/props-util'

const Marks = {
functional: true,
render (createElement, context) {
render (h, context) {
const {
className,
vertical,
Expand All @@ -22,7 +22,7 @@ const Marks = {

const range = max - min
const elements = marksKeys.map(parseFloat).sort((a, b) => a - b).map(point => {
const markPoint = marks[point]
const markPoint = typeof marks[point] === 'function' ? marks[point](h) : marks[point]
const markPointIsObject = typeof markPoint === 'object' &&
!isValidElement(markPoint)
const markLabel = markPointIsObject ? markPoint.label : markPoint
Expand Down

0 comments on commit 2a26caa

Please sign in to comment.