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
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
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

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" 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" 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" 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" 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:circle" md="material:brightness_low"></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:circle_half" md="material:brightness_high"></f7-icon>
  64. </f7-list-item-cell>
  65. </f7-list-item>
  66. </f7-list>
  67. </f7-page>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. priceMin: 200,
  74. priceMax: 400,
  75. };
  76. },
  77. methods: {
  78. onPriceChange(values) {
  79. this.priceMin = values[0];
  80. this.priceMax = values[1];
  81. },
  82. },
  83. };
  84. </script>