fix: vc-slider Range

This commit is contained in:
wangxueliang 2018-11-29 16:41:11 +08:00
parent e825830079
commit 8e533e6b8e
3 changed files with 7 additions and 8 deletions

View File

@ -19,17 +19,15 @@ export default {
}, },
render () { render () {
const handle = (h, props) => { const handle = (h, props) => {
const { value, dragging, index, refStr, style, ...restProps } = props const { value, dragging, index, ref, style, ...restProps } = props
const handleProps = { const handleProps = {
props: { props: {
...restProps, ...restProps,
value, value,
}, },
attrs: {
refStr,
},
key: index, key: index,
style, style,
ref,
} }
return ( return (
<Tooltip <Tooltip
@ -45,7 +43,7 @@ export default {
) )
} }
const handleRange = (h, { value, dragging, index, disabled, style, ...restProps }) => { const handleRange = (h, { value, ref, dragging, index, disabled, style, ...restProps }) => {
const tipFormatter = value => `${value}%` const tipFormatter = value => `${value}%`
const tipProps = {} const tipProps = {}
@ -85,6 +83,7 @@ export default {
style: { style: {
...handleStyleWithIndex, ...handleStyleWithIndex,
}, },
ref,
} }
return ( return (

View File

@ -118,7 +118,7 @@ const Range = {
this.onChange({ bounds: nextBounds }) this.onChange({ bounds: nextBounds })
}, },
onEnd () { onEnd () {
this.setState({ sHandle: null }, this.onBlur) this.setState({ sHandle: null }, this.blur)
this.removeDocumentEvents() this.removeDocumentEvents()
this.$emit('afterChange', this.bounds) this.$emit('afterChange', this.bounds)
}, },
@ -210,7 +210,7 @@ const Range = {
nextHandle = nextBounds.indexOf(value) nextHandle = nextBounds.indexOf(value)
} }
this.onChange({ this.onChange({
handle: nextHandle, sHandle: nextHandle,
bounds: nextBounds, bounds: nextBounds,
}) })
if (isFromKeyboardEvent) { if (isFromKeyboardEvent) {

View File

@ -6,7 +6,7 @@ import Handle from './Handle'
export default function createSliderWithTooltip (Component) { export default function createSliderWithTooltip (Component) {
return { return {
mixins: [BaseMixin], mixins: [BaseMixin, Component],
props: { props: {
...Component.props, ...Component.props,
tipFormatter: PropTypes.func.def((value) => { return value }), tipFormatter: PropTypes.func.def((value) => { return value }),