[Vuejs]-Using V-For to provide values to Radio Button input?

3👍

  1. Render the list of Users with v-for.
  2. Bind the <input>.value to each item’s name in the v-for. This sets the radio’s intended value when selected, and that’s reflected in the v-model.
<label v-for="user in Users" 1️⃣ >
  <input type="radio" v-model="picked" :value="user.name" 2️⃣ />
  <span>{{ user.name }}</span>
</label>

demo

👤tony19

Leave a comment