0๐
var app = new Vue({
el: '#app',
data: {
selected: ''
},
watch:{
selected:function(){
console.log('selected is ' +this.selected+" do you logic here");
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<body>
<div id="app">
<select v-model="selected">
<option value="" disabled selected>Marital Status</option>
<option>Married</option>
<option>Single</option>
<option>Divorced</option>
<option>Widow</option>
</select>
Selected:{{selected}}
</div>
</body>
Are you looking for something like this?
<select name="maritalStatus" v-model="selected">
<option value="" disabled selected>Marital Status</option>
<option>Married</option>
<option>Single</option>
<option>Divorced</option>
<option>Widow</option>
</select>
Additionally you can add a watcher to call save()
watch:{
selected:function(new,old){
//write your logic here
}
}
Source:stackexchange.com