I have a functional select box that is currently sending the selected value to a method when the change event occurs. However, I am wondering about something:
Let's say I also want to send the cat_id
value at the time of selection (to create an object linking the cat_id and date within the method). Is there a way to include that cat_id, or any other data, in the select box change event?
var vm =
new Vue({
el: "#app",
props: {
},
data: {
testing_dates:['2021-11-29', '2021-11-30'],
cat_id: [123]
},
methods: {
testChange(event){
console.log(event.target.value);
},
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<li>Category ID: {{ cat_id }}</li>
<li style="list-style: none;">
<select style="width: auto;" @change="testChange($event)">
<option selected disabled>Options</option>
<option v-for="date in testing_dates" :value="date">{{ date }}</option>
</select>
</li>
</div>