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

PropTypeDefaultDescription
<f7-range> properties
initbooleantrueInitializes Range Slider
valuenumber
array
string
Range Slider value, must be array in case of dual range slider
minnumber
string
Minimum value
maxnumber
string
Maximum value
stepnumber
string
1Maximum value
labelbooleanfalseEnables additional label around range slider knob
dualbooleanfalseEnables dual range slider
verticalbooleanfalseEnables vertical range slider
vertical-reversedbooleanfalseMakes vertical range slider reversed. (Only when vertical:true)
draggable-barbooleantrueWhen enabled it is also possible to interact with range slider (change value) on range bar click and swipe.
format-labelfunction(value)Method must return formatted range knob label text. As an argument it receives label value
scalebooleanfalseEnables range slider scale
scale-stepsnumber5Number of scale steps
scale-sub-stepsnumber0Number of scale sub steps (each step will be divided by this value)
format-scale-labelfunction (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-positionbooleanLimits knob position to the size of the range bar. By default enabled from iOS theme
disabledbooleanfalseDefines whether the range slider is disabled or not
idstringRange slider element ID attribute
inputbooleanfalseIf enabled, then it will render input type=”range” element inside as well
input-idstringInput element ID attribute
namestringInput element “name” attribute

Range Slider Events

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

Range Slider Methods

EventDescription
<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>
  4. <f7-block-title>Volume</f7-block-title>
  5. <f7-list simple-list>
  6. <f7-list-item>
  7. <f7-list-item-cell class="width-auto flex-shrink-0">
  8. <f7-icon ios="f7:volume_mute_fill" aurora="f7:volume_mute_fill" md="material:volume_mute"></f7-icon>
  9. </f7-list-item-cell>
  10. <f7-list-item-cell class="flex-shrink-3">
  11. <f7-range
  12. :min="0"
  13. :max="100"
  14. :step="1"
  15. :value="10"
  16. ></f7-range>
  17. </f7-list-item-cell>
  18. <f7-list-item-cell class="width-auto flex-shrink-0">
  19. <f7-icon ios="f7:volume_fill" aurora="f7:volume_fill" md="material:volume_up"></f7-icon>
  20. </f7-list-item-cell>
  21. </f7-list-item>
  22. </f7-list>
  23. <f7-block-title>Brightness</f7-block-title>
  24. <f7-list simple-list>
  25. <f7-list-item>
  26. <f7-list-item-cell class="width-auto flex-shrink-0">
  27. <f7-icon ios="f7:circle" aurora="f7:circle" md="material:brightness_low"></f7-icon>
  28. </f7-list-item-cell>
  29. <f7-list-item-cell class="flex-shrink-3">
  30. <f7-range
  31. :min="0"
  32. :max="100"
  33. :step="1"
  34. :value="50"
  35. :label="true"
  36. color="orange"
  37. ></f7-range>
  38. </f7-list-item-cell>
  39. <f7-list-item-cell class="width-auto flex-shrink-0">
  40. <f7-icon ios="f7:circle_half" aurora="f7:circle_half" md="material:brightness_high"></f7-icon>
  41. </f7-list-item-cell>
  42. </f7-list-item>
  43. </f7-list>
  44. <f7-block-title class="display-flex justify-content-space-between">Price Filter <span>${{priceMin}} - ${{priceMax}}</span></f7-block-title>
  45. <f7-list simple-list>
  46. <f7-list-item>
  47. <f7-list-item-cell class="width-auto flex-shrink-0">
  48. <f7-icon ios="f7:money_dollar_round" aurora="f7:money_dollar_round" md="material:attach_money"></f7-icon>
  49. </f7-list-item-cell>
  50. <f7-list-item-cell class="flex-shrink-3">
  51. <f7-range
  52. :min="0"
  53. :max="500"
  54. :step="1"
  55. :value="[priceMin, priceMax]"
  56. :label="true"
  57. :dual="true"
  58. color="green"
  59. @range:change="onPriceChange"
  60. ></f7-range>
  61. </f7-list-item-cell>
  62. <f7-list-item-cell class="width-auto flex-shrink-0">
  63. <f7-icon ios="f7:money_dollar_round_fill" aurora="f7:money_dollar_round_fill" md="material:monetization_on"></f7-icon>
  64. </f7-list-item-cell>
  65. </f7-list-item>
  66. </f7-list>
  67. <f7-block-title>With Scale</f7-block-title>
  68. <f7-block strong>
  69. <f7-range
  70. :min="0"
  71. :max="100"
  72. :label="true"
  73. :step="5"
  74. :value="25"
  75. :scale="true"
  76. :scale-steps="5"
  77. :scale-sub-steps="4"
  78. ></f7-range>
  79. </f7-block>
  80. <f7-block-title>Vertical</f7-block-title>
  81. <f7-block strong class="display-flex justify-content-center">
  82. <f7-range
  83. class="margin-right"
  84. style="height: 160px"
  85. :vertical="true"
  86. :min="0"
  87. :max="100"
  88. :label="true"
  89. :step="1"
  90. :value="25"
  91. /></f7-range>
  92. <f7-range
  93. class="margin-horizontal"
  94. style="height: 160px"
  95. :vertical="true"
  96. :min="0"
  97. :max="100"
  98. :label="true"
  99. :step="1"
  100. :value="50"
  101. /></f7-range>
  102. <f7-range
  103. class="margin-horizontal"
  104. style="height: 160px"
  105. :vertical="true"
  106. :min="0"
  107. :max="100"
  108. :label="true"
  109. :step="1"
  110. :value="75"
  111. /></f7-range>
  112. <f7-range
  113. class="margin-left"
  114. style="height: 160px"
  115. :dual="true"
  116. :vertical="true"
  117. :min="0"
  118. :max="100"
  119. :label="true"
  120. :step="1"
  121. :value="[25, 75]"
  122. /></f7-range>
  123. </f7-block>
  124. <f7-block-title>Vertical Reversed</f7-block-title>
  125. <f7-block strong class="display-flex justify-content-center">
  126. <f7-range
  127. class="margin-right"
  128. color="red"
  129. style="height: 160px"
  130. :vertical="true"
  131. :vertical-reversed="true"
  132. :min="0"
  133. :max="100"
  134. :label="true"
  135. :step="1"
  136. :value="25"
  137. /></f7-range>
  138. <f7-range
  139. class="margin-horizontal"
  140. color="red"
  141. style="height: 160px"
  142. :vertical="true"
  143. :vertical-reversed="true"
  144. :min="0"
  145. :max="100"
  146. :label="true"
  147. :step="1"
  148. :value="50"
  149. /></f7-range>
  150. <f7-range
  151. class="margin-horizontal"
  152. color="red"
  153. style="height: 160px"
  154. :vertical="true"
  155. :vertical-reversed="true"
  156. :min="0"
  157. :max="100"
  158. :label="true"
  159. :step="1"
  160. :value="75"
  161. /></f7-range>
  162. <f7-range
  163. class="margin-left"
  164. color="red"
  165. style="height: 160px"
  166. :dual="true"
  167. :vertical="true"
  168. :vertical-reversed="true"
  169. :min="0"
  170. :max="100"
  171. :label="true"
  172. :step="1"
  173. :value="[25, 75]"
  174. /></f7-range>
  175. </f7-block>
  176. </f7-page>
  177. </template>
  178. <script>
  179. export default {
  180. data() {
  181. return {
  182. priceMin: 200,
  183. priceMax: 400,
  184. };
  185. },
  186. methods: {
  187. onPriceChange(values) {
  188. this.priceMin = values[0];
  189. this.priceMax = values[1];
  190. },
  191. },
  192. };
  193. </script>