JSFiddle - React, Tailwind, and code Playground
by Luiz Vargas
HTML
<div id="app">
<select v-model="customer">
<option>Select a customer</option>
<option v-for="(text, val) in options" :value="val">{{text}}</option>
</select>
{{customer}} {{customerName}}
</div>
JavaScript
var app = new Vue({
el: '#app',
data: {
customer: '',
options: {
1: 'Jan',
2: 'Doe',
3: 'Khan'
}
},
computed:{
customerName(){
return this.options[this.customer]
}
}
});