Luckily for you, Vue can loop through the properties in an Object as described in v-for with an Object.
I've also included a snippet below which should help you achieve what you want.
Vue.config.productionTip = false;
Vue.config.devtools = false;
new Vue({
el: "#app",
data: () => {
return {
persons: {
"2": "Person1",
"3": "Person2",
"4": "Person3"
}
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<select id="persons">
<option v-for="(name, id) in persons" :value="id">{{name}}</option>
</select>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…