Update Range Input in Vue. Js 3

How can I update or show the actual value of a range input in Vue 3?

I thought it would be possible wiht v-model like this:

<input id="rangeSlider" type="range" class="form-range" v-model="value" min="0" max="5" step="0.2"/> 

            <label for="rangeSlider" class="sliderValue">
                Value: {{ value }} m
            </label>

1 Answer

It actually works exactly the same as the Vue2, just a little bit different Vue setup

const app = Vue.createApp({
    data: () => ({
    value: 0
  })
})
const vm = app.mount('#app')
<script src="[email protected]/dist/vue.global.js"></script>
<div id="app">
  <input id="rangeSlider" type="range" class="form-range" v-model="value" min="0" max="5" step="0.2"/> 

  <label for="rangeSlider" class="sliderValue">
    Value: {{ value }} m
  </label>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest