array vue html select option for

Solutions on MaxInterview for array vue html select option for by the best coders in the world

showing results for - "array vue html select option for"
Daniel
02 Jan 2020
1<script>
2var selector = new Vue({
3  el: '#selector',
4  data: {
5    selected: '',
6    reasons: {
7      "select1": "Select 1",
8      "select2": "Select 2",
9      "select3": "Select 3",
10      "select4": "Select 4",
11      "select5": "Select 5",
12      "select6": "Select 6",
13      "select7": "Select 7"
14    }
15  }
16})
17</script>
18<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
19<div id="selector">
20  <select v-model="selected">
21    <option v-for="(item, key) in reasons" :value="key">
22      {{item}}
23    </option>
24  </select>
25  <br>
26  <br>
27  <span>Selected: {{ selected }}</span>
28</div>
29
30
31url: https://stackoverflow.com/a/43462086/13779574