Reputation: 4232
How to send an ajax request when an item is selected in a "Select" of vuejs via vue-resource?
demo: https://jsfiddle.net/xoyhdaxy/
<div class="container" id="app">
<select v-model="selected">
<option v-for="option in options" v-bind:value="option.value">
{{ option.text }}
</option>
</select>
<span>Selected: {{ selected }}</span>
</div>
new Vue({
el: '#app',
data: {
selected: '1',
options: [
{ text: 'One', value: '1' },
{ text: 'Two', value: '2' },
{ text: 'Three', value: '3' }
]
}
});
For example:
When the item "two" is selected,an ajax request is triggered with the value "2" via vue-resource,how to write the code?
Upvotes: 0
Views: 374