You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
| direction| String| horizontal| Set the direction of the component, optional value:['horizontal', 'vertical']|
33
+
| event-type| String| auto| The event type, optional value:['auto', 'none']|
34
+
| width| Number[,String(in horizontal)]| auto| Width of the component|
35
+
| height| Number[,String(in vertical)]| 6| Height of the component|
36
+
| dot-size| Number| 16| Determines width and height of the sliders. to set different values of`width` &`height` use`dot-width` &`dot-height` props|
37
+
| dot-width| Number| value of`dot-size` prop| Width of sliders. If specified, overrides value of`dot-size`|
38
+
| dot-height| Number| value of`dot-size` prop| Height of sliders. If specified, overrides value of`dot-size`|
39
+
| min| Number| 0| The minimum numerical value that can be selected|
40
+
| max| Number| 100| The maximum numerical value that can be selected|
41
+
| interval| Number| 1| The gap between the values|
42
+
| show| Boolean| true| Display of the component|
43
+
| speed| Number| 0.5| Transition time|
44
+
| disabled| Boolean[, Array<Boolean>(in range model)]| false| Whether to disable the component|
45
+
| debug| Boolean| true| If you do not need to print errors in the production environment, can be set to`process.env.NODE_ENV !== 'production'`|
46
+
| piecewise| Boolean| false| Whether to display sub-values as as piecewise nodes|
47
+
| piecewise-label*| Boolean| false| Whether to display the label.|
48
+
| tooltip| String, Boolean| always| Control the tooltip, optional value:['hover', 'always', false]|
49
+
| tooltip-dir| String[,Array(in range model)| top(in horizontal)or left(in vertical)| Set the direction of the tooltip, optional value:['top', 'bottom', 'left', 'right']|
50
+
| reverse| Boolean| false| Whether the component reverse (such as Right to left, Top to bottom)|
51
+
| value| Number, String, Array, Object| 0| Initial value (if the value for the array open range model)|
52
+
| data| Array| null| The custom data.|
53
+
| clickable| Boolean| true| Whether or not the slider is clickable as well as drag-able|
54
+
| enable-cross*| Boolean| true| Whether to allow crossover in range mode|
55
+
| start-animation*| Boolean| false| Whether to enable the initial animation|
56
+
| tooltip-merge*| Boolean| true| Whether to merge with tooltip overlap|
57
+
| merge-formatter*| String, Function| null| Formatting of the merged value, for example:`merge-formatter="¥{value1} ~ ¥{value2}"` or`` merge-formatter: (v1, v2) => `¥${v1} ~ ¥${v2}```.|
58
+
| stop-propagation*| Boolean| false| All events call`stopPropagation`|
59
+
| real-time*| Boolean| false| Whether the real-time computing the layout of the components|
60
+
| lazy*| Boolean| false| At the end of the drag and drop, to synchronization value (if each update to high consumption of operation (such as Ajax), it is more useful)|
61
+
| fixed* | Boolean | false | Fixed distance between two values (valid only in range mode).[Example]
62
+
| min-range* | Number | null | Minimum range in range mode
63
+
| max-range* | Number | null | Maximum range in range mode
64
+
| process-draggable*| Boolean| false| Whether the process bar is draggable (valid only in range mode).|
65
+
| formatter*| String,Function| null | Formatting of a tooltip's values, for example:`formatter='¥{value}'` or`` formatter: (v) => `¥${v}```.|
66
+
| use-keyboard*| Boolean| false| Whether to open the keyboard control (Only support the arrow keys).|
67
+
| actions-keyboard*| Array|`[(i) => i - 1, (i) => i + 1]`| In the keyboard control mode, reduce(←, ↓) and increase(→, ↑) the calling method.(`i` is the index value)|
68
+
| bg-style*| Object| null| The style of the background.|
69
+
| slider-style*| Object[, Array(in range model), Function<Value, Index>]| null| The style of the slider.|
70
+
| disabled-style*| Object| null| The style of the slider in disabled state.|
71
+
| disabled-dot-style*| Object, Array, Function<Value, Index>]| null| The style of the dot in disabled state.|
72
+
| process-style*| Object| null| The style of the process bar.|
73
+
| piecewise-style*| Object| null| The style of the piecewise dot.|
74
+
| piecewise-active-style*| Object| null| The style of the piecewise dot in the activated state.|
75
+
| tooltip-style*| Object[, Array(in range model), Function<Value, Index>]| null| The style of the tooltip.|
76
+
| label-style*| Object| null| The style of the label.|
77
+
| label-active-style*| Object| null| The style of the label in the activated state.|
78
+
| focus-style*| Object[, Array(in range model), Function<Value, Index>]| null| The style of the slider when it is focused. (Works only when`use-keyboard` is`true`)|
| setValue| Params: value[, noCallback: boolean, speed: number]| set value of the component|
86
+
| setIndex| Params: index*| set index of the component|
87
+
| getValue| Return: value| get value of the component|
88
+
| getIndex| Return: index*| get index of the component|
89
+
| refresh| null| Refresh the component|
90
+
91
+
*[ index] is the index to the array in the custom data model *
92
+
*[ index] is equal to (( value - min ) / interval ) in normal mode *
93
+
94
+
###Events
95
+
| Name| Type| Description|
96
+
| --------------|:--------------|--------------|
97
+
| callback| Params: value[Number\| Array]| values change when the callback function. (Changes in the direct assignment value will not trigger the callback, it is recommended to use`setValue` method)|
98
+
| drag-start | Params: context[Object]| Drag the start event|
99
+
| drag-end| Params: context[Object]| Drag the end event|
| tooltip| Customize the tooltip slot. optional value:[`value`,`index`,`disabled`(only range model),`merge`(only tooltipMerge is`true`)]|
106
+
| piecewise| Customize the piecewise slot. optional value:[`label`,`index`,`active`,`first`,`last`]|
107
+
| label| Customize the label slot. optional value:[`label`,`index`,`active`,`first`,`last`]|
108
+
109
+
[#](https://vuejs.org/v2/guide/components.html#Scoped-Slots) When using the template element as a slot, can add special properties`scope` or`slot-scope` to get the value.
110
+
111
+
e.g.
112
+
```html
113
+
<vue-range-sliderv-model="value">
114
+
<templateslot="tooltip"scope="{value}">
115
+
<divclass="diy-tooltip">
116
+
{{ value }}
117
+
</div>
118
+
</template>
119
+
</vue-range-slider>
120
+
121
+
<!-- In vue2.5 above, please use slot-scope instead of scope-->
122
+
<vue-range-sliderv-model="value">
123
+
<divclass="diy-tooltip"slot="tooltip"slot-scope="{ value }">
124
+
{{ value }}
125
+
</div>
126
+
</vue-range-slider>
127
+
```
128
+
129
+
##Using it with NUXT.js
130
+
131
+
This hack is just to avoid the server side 'document' error when using it with Nuxt.js.
132
+
Use it if you don't need to have this component rendered on the server side.
133
+
134
+
1. Install[this](https://github.com/egoist/vue-no-ssr) and add it to the variable`components`. i.e.
135
+
```js
136
+
importNoSSRfrom'vue-no-ssr'
137
+
138
+
let components= {
139
+
/**
140
+
* Add No Server Side Render component
141
+
* to make client DOM math the server DOM
142
+
*/
143
+
'no-ssr': NoSSR
144
+
}
145
+
```
146
+
147
+
2. In your template, encapsulate 'vue-range-slider' into the 'no-ssr' component to avoid redner the html on the server like this:
148
+
```html
149
+
<no-ssr>
150
+
<vue-range-sliderref="slider"></vue-range-slider>
151
+
</no-ssr>
152
+
```
153
+
154
+
3. Require the library just for client side and add the 'vue-range-slider' component to the template component list
155
+
```js
156
+
if (process.browser) {
157
+
// in older versions of nuxt, it's process.BROWSER_BUILD