Range Slider - 图1

Range Slider Vue Component

Range Slider Vue component represents Range Slider component.

Range Slider Components

There are following components included:

  • **f7-range**

Range Slider Properties

Prop Type Default Description
<f7-range> properties
--- --- --- ---
init boolean true Initializes Range Slider
value number array string Range Slider value, must be array in case of dual range slider
min number string Minimum value
max number string Maximum value
step number string 1 Maximum value
label boolean false Enables additional label around range slider knob
dual boolean false Enables dual range slider
vertical boolean false Enables vertical range slider
vertical-reversed boolean false Makes vertical range slider reversed. (Only when vertical:true)
draggable-bar boolean true When enabled it is also possible to interact with range slider (change value) on range bar click and swipe.
format-label function(value) Method must return formatted range knob label text. As an argument it receives label value
scale boolean false Enables range slider scale
scale-steps number 5 Number of scale steps
scale-sub-steps number 0 Number of scale sub steps (each step will be divided by this value)
format-scale-label function (value) Method must return formatted scale value. As an argument it receives currect scale step value. This method will be called as for each scale step.
limit-knob-position boolean Limits knob position to the size of the range bar. By default enabled from iOS theme
disabled boolean false Defines whether the range slider is disabled or not
id string Range slider element ID attribute
input boolean false If enabled, then it will render input type=”range” element inside as well
input-id string Input element ID attribute
name string Input element “name” attribute

Range Slider Events

Event Description
<f7-range> events
--- ---
range:change Event will be triggered when Range Slider value has been changed
range:changed Event will be triggered on slider knob release after value change

Range Slider Methods

Event Description
<f7-range> methods
--- ---
.setValue(newValue) Set new range slider value
.getValue() Returns range slider value

Examples

1. <template>
2. <f7-page>
3. <f7-navbar title="Range Slider"></f7-navbar>

5. <f7-block-title>Volume</f7-block-title>
6. <f7-list simple-list>
7. <f7-list-item>
8. <f7-list-item-cell class="width-auto flex-shrink-0">
9. <f7-icon ios="f7:volume_mute_fill" aurora="f7:volume_mute_fill" md="material:volume_mute"></f7-icon>
10. </f7-list-item-cell>
11. <f7-list-item-cell class="flex-shrink-3">
12. <f7-range
13. :min="0"
14. :max="100"
15. :step="1"
16. :value="10"
17. ></f7-range>
18. </f7-list-item-cell>
19. <f7-list-item-cell class="width-auto flex-shrink-0">
20. <f7-icon ios="f7:volume_fill" aurora="f7:volume_fill" md="material:volume_up"></f7-icon>
21. </f7-list-item-cell>
22. </f7-list-item>
23. </f7-list>

25. <f7-block-title>Brightness</f7-block-title>
26. <f7-list simple-list>
27. <f7-list-item>
28. <f7-list-item-cell class="width-auto flex-shrink-0">
29. <f7-icon ios="f7:circle" aurora="f7:circle" md="material:brightness_low"></f7-icon>
30. </f7-list-item-cell>
31. <f7-list-item-cell class="flex-shrink-3">
32. <f7-range
33. :min="0"
34. :max="100"
35. :step="1"
36. :value="50"
37. :label="true"
38. color="orange"
39. ></f7-range>
40. </f7-list-item-cell>
41. <f7-list-item-cell class="width-auto flex-shrink-0">
42. <f7-icon ios="f7:circle_half" aurora="f7:circle_half" md="material:brightness_high"></f7-icon>
43. </f7-list-item-cell>
44. </f7-list-item>
45. </f7-list>

47. <f7-block-title class="display-flex justify-content-space-between">Price Filter <span>${{priceMin}} - ${{priceMax}}</span></f7-block-title>
48. <f7-list simple-list>
49. <f7-list-item>
50. <f7-list-item-cell class="width-auto flex-shrink-0">
51. <f7-icon ios="f7:money_dollar_round" aurora="f7:money_dollar_round" md="material:attach_money"></f7-icon>
52. </f7-list-item-cell>
53. <f7-list-item-cell class="flex-shrink-3">
54. <f7-range
55. :min="0"
56. :max="500"
57. :step="1"
58. :value="[priceMin, priceMax]"
59. :label="true"
60. :dual="true"
61. color="green"
62. @range:change="onPriceChange"
63. ></f7-range>
64. </f7-list-item-cell>
65. <f7-list-item-cell class="width-auto flex-shrink-0">
66. <f7-icon ios="f7:money_dollar_round_fill" aurora="f7:money_dollar_round_fill" md="material:monetization_on"></f7-icon>
67. </f7-list-item-cell>
68. </f7-list-item>
69. </f7-list>

71. <f7-block-title>With Scale</f7-block-title>
72. <f7-block strong>
73. <f7-range
74. :min="0"
75. :max="100"
76. :label="true"
77. :step="5"
78. :value="25"
79. :scale="true"
80. :scale-steps="5"
81. :scale-sub-steps="4"
82. ></f7-range>
83. </f7-block>

85. <f7-block-title>Vertical</f7-block-title>
86. <f7-block strong class="display-flex justify-content-center">
87. <f7-range
88. class="margin-right"
89. style="height: 160px"
90. :vertical="true"
91. :min="0"
92. :max="100"
93. :label="true"
94. :step="1"
95. :value="25"
96. /></f7-range>
97. <f7-range
98. class="margin-horizontal"
99. style="height: 160px"
100. :vertical="true"
101. :min="0"
102. :max="100"
103. :label="true"
104. :step="1"
105. :value="50"
106. /></f7-range>
107. <f7-range
108. class="margin-horizontal"
109. style="height: 160px"
110. :vertical="true"
111. :min="0"
112. :max="100"
113. :label="true"
114. :step="1"
115. :value="75"
116. /></f7-range>
117. <f7-range
118. class="margin-left"
119. style="height: 160px"
120. :dual="true"
121. :vertical="true"
122. :min="0"
123. :max="100"
124. :label="true"
125. :step="1"
126. :value="[25, 75]"
127. /></f7-range>
128. </f7-block>

130. <f7-block-title>Vertical Reversed</f7-block-title>
131. <f7-block strong class="display-flex justify-content-center">
132. <f7-range
133. class="margin-right"
134. color="red"
135. style="height: 160px"
136. :vertical="true"
137. :vertical-reversed="true"
138. :min="0"
139. :max="100"
140. :label="true"
141. :step="1"
142. :value="25"
143. /></f7-range>
144. <f7-range
145. class="margin-horizontal"
146. color="red"
147. style="height: 160px"
148. :vertical="true"
149. :vertical-reversed="true"
150. :min="0"
151. :max="100"
152. :label="true"
153. :step="1"
154. :value="50"
155. /></f7-range>
156. <f7-range
157. class="margin-horizontal"
158. color="red"
159. style="height: 160px"
160. :vertical="true"
161. :vertical-reversed="true"
162. :min="0"
163. :max="100"
164. :label="true"
165. :step="1"
166. :value="75"
167. /></f7-range>
168. <f7-range
169. class="margin-left"
170. color="red"
171. style="height: 160px"
172. :dual="true"
173. :vertical="true"
174. :vertical-reversed="true"
175. :min="0"
176. :max="100"
177. :label="true"
178. :step="1"
179. :value="[25, 75]"
180. /></f7-range>
181. </f7-block>
182. </f7-page>
183. </template>

185. <script>
186. export default {
187. data() {
188. return {
189. priceMin: 200,
190. priceMax: 400,
191. };
192. },
193. methods: {
194. onPriceChange(values) {
195. this.priceMin = values[0];
196. this.priceMax = values[1];
197. },
198. },
199. };
200. </script>