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 type="range" v-model="value" min="0" max="5" step="0.2"/> <label for="rangeSlider"> 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> <input type="range" v-model="value" min="0" max="5" step="0.2"/> <label for="rangeSlider"> Value: {{ value }} m </label> </div>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.