[Vuejs]-Check correct radio button based on db value

0👍

If you bind each of your radio buttons to the same model, it should work. Here’s a simple example:

  <input type="radio" id="1" value="One" v-model="picked">
  <label for="one">One</label>
  <br>
  <input type="radio" id="2" value="Two" v-model="picked">
  <label for="two">Two</label>
  <br>
  <span>Picked: {{ picked }}</span>


var app = new Vue({
    el: '#app',
    data: {
        picked: '2'
    }
});

Here’s a repl.it you can play with: https://repl.it/@jmbldwn/vueJS

Leave a comment