Vue Js Range Slider Example Tutorial

Vue js range slider; Through this tutorial, i am going to show you how to build range slider in vue js app.

Vue Js Range Slider Example Tutorial

Use below given steps and build and use range slider in vue js app:

  • Step 1 – Create New VUE JS App
  • Step 2 – Install Slider Package in Vue Js App
  • Step 3 – Import Component on App.vue

Step 1 – Create New VUE JS App

Run the following command on terminal to create new vue js app:

vue create my-app

Step 2 – Install Slider Package in Vue Js App

Run the following command to install range slider package in vue js app:

cd my-app

npm install vue-range-component --save

Step 3 – Import Component on App.vue

Go to src/ directory and open App.vue file. And then add the following code into it:

<template>
  <div class="app-content">
    <vue-range-slider v-model="value" :min="min" :max="max" :formatter="formatter"></vue-range-slider>
  </div>
</template>
<script>
import 'vue-range-component/dist/vue-range-slider.css'
import VueRangeSlider from 'vue-range-component'
export default {
  data() {
    return {
      value: [0, 100]
    }
  },
  components: {
    VueRangeSlider
  },
  created() {
    this.min = 0
    this.max = 250
    this.formatter = value => `¥${value}`
  }
}
</script> 

Conclusion

vue js range slider example. In this tutorial, you have learned how to implement range slider in vue js app.

Recommended VUE JS Tutorials

Leave a Comment