Apologies for the beginner question. I am trying to figure out how to retrieve the index of a selected element from a select box and then execute a function. The following code snippet is not triggering the switchView() function as expected.
<select id="selectbox" @change="switchView(index)">
<option [v-for="(item, index) in items" v-bind:value="item.title"]>
{{ item.title }}
</option>
</select>
Any assistance would be greatly appreciated.
UPDATE:
Thanks to @Phil's advice, I have relocated @change="switchView(index)"
from <option>
to <select>
.
The reason I need the index is because I have multiple calculated items and I need to adjust the view based on the user's selection from these items.