Answers for "array vue html select option for"

0

array vue html select option for

<script>
var selector = new Vue({
  el: '#selector',
  data: {
    selected: '',
    reasons: {
      "select1": "Select 1",
      "select2": "Select 2",
      "select3": "Select 3",
      "select4": "Select 4",
      "select5": "Select 5",
      "select6": "Select 6",
      "select7": "Select 7"
    }
  }
})
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="selector">
  <select v-model="selected">
    <option v-for="(item, key) in reasons" :value="key">
      {{item}}
    </option>
  </select>
  <br>
  <br>
  <span>Selected: {{ selected }}</span>
</div>


url: https://stackoverflow.com/a/43462086/13779574
Posted by: Guest on September-10-2021

Code answers related to "array vue html select option for"

Browse Popular Code Answers by Language