update vc-slider
parent
3bd916b73e
commit
847bed5bca
|
@ -172,7 +172,7 @@ class Slider extends React.Component {
|
||||||
const _trackStyle = trackStyle[0] || trackStyle
|
const _trackStyle = trackStyle[0] || trackStyle
|
||||||
const track = (
|
const track = (
|
||||||
<Track
|
<Track
|
||||||
className={`${prefixCls}-track`}
|
class={`${prefixCls}-track`}
|
||||||
vertical={vertical}
|
vertical={vertical}
|
||||||
included={included}
|
included={included}
|
||||||
offset={0}
|
offset={0}
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable */
|
||||||
import React from 'react'
|
const Track = {
|
||||||
|
functional: true,
|
||||||
|
render (createElement, context) {
|
||||||
|
const { included, vertical, offset, length, style } = context.data
|
||||||
|
|
||||||
const Track = (props) => {
|
const positonStyle = vertical ? {
|
||||||
const { className, included, vertical, offset, length, style } = props
|
bottom: `${offset}%`,
|
||||||
|
height: `${length}%`,
|
||||||
|
} : {
|
||||||
|
left: `${offset}%`,
|
||||||
|
width: `${length}%`,
|
||||||
|
}
|
||||||
|
|
||||||
const positonStyle = vertical ? {
|
context.data.style = {
|
||||||
bottom: `${offset}%`,
|
...style,
|
||||||
height: `${length}%`,
|
...positonStyle,
|
||||||
} : {
|
}
|
||||||
left: `${offset}%`,
|
return included ? createElement('div', context.data, context.children) : null
|
||||||
width: `${length}%`,
|
},
|
||||||
}
|
|
||||||
|
|
||||||
const elStyle = {
|
|
||||||
...style,
|
|
||||||
...positonStyle,
|
|
||||||
}
|
|
||||||
return included ? <div className={className} style={elStyle} /> : null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Track
|
export default Track
|
||||||
|
|
Loading…
Reference in New Issue