Skip to content

Commit

Permalink
feat: add startAnimation
Browse files Browse the repository at this point in the history
  • Loading branch information
NightCatSama committed Aug 11, 2018
1 parent 2b18f2c commit fa187fc
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import vueSlider from 'vue-slider-component/src/vue2-slider.vue'
| value | Number, String, Array, Object | 0 | Initial value (if the value for the array open range model) |
| data | Array | null | The custom data. |
| clickable | Boolean | true | Whether or not the slider is clickable as well as drag-able |
| startAnimation | Boolean | false | Whether to enable the initial animation |
| tooltip-merge* | Boolean | true | Whether to merge with tooltip overlap |
| merge-formatter* | String, Function | null | Formatting of the merged value, for example: `merge-formatter="¥{value1} ~ ¥{value2}"` or `` merge-formatter: (v1, v2) => `¥${v1} ~ ¥${v2}` ``. |
| stop-propagation* | Boolean | false | All events call `stopPropagation` |
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/dist/build.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions example/src/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1>Example</h1>
<section data-title="Default" id="demo">
<div>
<vue-slider ref="slider" v-model="demo.default.customProp.value" v-bind="demo.default"></vue-slider>
<vue-slider ref="slider" v-model="demo.default.value" v-bind="demo.default"></vue-slider>
<h3><small>Value: </small>{{ demo.default.value }}</h3>
</div>
<div>
Expand Down Expand Up @@ -228,10 +228,7 @@ export default {
orange_cat: 'http://7xqnme.com1.z0.glb.clouddn.com/17-6-8/88421800.jpg',
demo: {
default: {
customProp: {
value: 2
},
// value: void 0,
value: 50,
width: 'auto',
height: 6,
direction: 'horizontal',
Expand All @@ -240,8 +237,9 @@ export default {
min: 0,
max: 100,
interval: 1,
startAnimation: false,
tooltipMerge: true,
// debug: process && process.env && process.env.NODE_ENV !== 'production',
debug: process && process.env && process.env.NODE_ENV !== 'production',
disabled: false,
show: true,
realTime: false,
Expand Down Expand Up @@ -488,6 +486,7 @@ export default {
piecewiseStyle: '分割点的样式',
disabledStyle: '组件禁用状态下样式',
focusStyle: '键盘控制时,算滑块获得焦点时样式',
startAnimation: '是否开启初始动画',
value: ''
}
},
Expand Down
6 changes: 5 additions & 1 deletion example/src/vue-slider/vue2-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@
type: Boolean,
default: true
},
startAnimation: {
type: Boolean,
default: false
},
sliderStyle: [Array, Object, Function],
focusStyle: [Array, Object, Function],
tooltipDir: [Array, String],
Expand Down Expand Up @@ -1035,7 +1039,7 @@
this.$nextTick(() => {
if (this.isComponentExists) {
this.getStaticData()
this.setValue(this.limitValue(this.value), true, 0)
this.setValue(this.limitValue(this.value), true, this.startAnimation ? this.speed : 0)
this.bindEvents()
}
})
Expand Down
6 changes: 5 additions & 1 deletion src/vue2-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@
type: Boolean,
default: true
},
startAnimation: {
type: Boolean,
default: false
},
sliderStyle: [Array, Object, Function],
focusStyle: [Array, Object, Function],
tooltipDir: [Array, String],
Expand Down Expand Up @@ -1035,7 +1039,7 @@
this.$nextTick(() => {
if (this.isComponentExists) {
this.getStaticData()
this.setValue(this.limitValue(this.value), true, 0)
this.setValue(this.limitValue(this.value), true, this.startAnimation ? this.speed : 0)
this.bindEvents()
}
})
Expand Down

0 comments on commit fa187fc

Please sign in to comment.