Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
Update Slider
Browse files Browse the repository at this point in the history
  • Loading branch information
okoala committed Dec 6, 2015
1 parent 60b27d9 commit b79e624
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
Empty file added components/base/slider/Dots.vue
Empty file.
Empty file.
Empty file.
91 changes: 91 additions & 0 deletions components/base/slider/Slider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<div :class="sliderClasses"
@touchstart="_onTouchStart"
@mousedown="_onMouseDown">
<track
:class="prefixCls + '-track'"
:included="isIncluded"
:offset="lowerOffset"
:length="upperOffset - lowerOffset"></track>
<dots
:prefix-cls="prefixCls"
:marks="marks"
:dots="dots"
:step="step"
:included="isIncluded"
:lower-bound="lowerBound"
:upper-bound="upperBound"
:max="max"
:min="min"></dots>
<marks
:class="prefixCls + '-mark'"
:marks="marks"
:ncluded="isIncluded"
:lower-bound="lowerBound"
:upper-bound="upperBound"
:max="max"
:min="min"></marks>
<slot></slot>
</div>
</template>

<script>
import { defaultProps, cx, oneOfType } from '../../../utils'
import Track from './Track.vue'
import Handle from './Handle.vue'
import Dots from './Dots.vue'
import Marks from './Marks.vue'
export default {
props: defaultProps({
prefixCls: 'vc-slider',
className: '',
tipTransitionName: '',
min: 0,
max: 100,
step: 1,
value: oneOfType([Number, Array]),
defaultValue: oneOfType([Number, Array]),
marks: {},
included: true,
disabled: false,
dots: false,
range: false,
tipTransitionName: String,
tipFormatter () {},
onBeforeChange () {},
onChange () {},
onAfterChange () {}
}),
components: { Track, Handle, Dots, Marks },
methods: {
_isNotTouchEvent (e) {
return e.touches.length > 1 ||
(e.type.toLowerCase() === 'touchend' && e.touches.length > 0)
},
_getTouchPosition (e) {
return e.touches[0].pageX
},
_getMousePosition (e) {
return e.pageX
},
_onTouchStart (e) {
if (this.disabled) {
return
}
},
_onMouseDown (e) {
if (this.disabled) {
return
}
}
}
}
</script>
Empty file.
3 changes: 3 additions & 0 deletions components/base/slider/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Slider from './Slider.vue'

export default Slider
Empty file added components/slider/Slider.vue
Empty file.

0 comments on commit b79e624

Please sign in to comment.