How can I get the values of row.question_id and option.AnswerMasterID in the method selectChange in the below code? I am using Vue.js v2.
<div v-if="row.answer_input_type === 'Dropdown'">
<template v-for="answer in answers">
<template v-if="answer.AnswerTypeID === row.answer_type_id">
<select class="dropdown_cl" v-bind:disabled="row.is_enabled == 1 ? false : true" @change="selectChange(row.question_id, answer.AnswerDescription)">
<option v-for="option in answer.AnswerDescription" v-bind:value="option.AnswerMasterID" >{{option.AnswerDescription}}</option>
</select>
<p v-for="option in answer.AnswerDescription">{{option.AnswerMasterID}}</p>
</template>
</template>
</div>
My method is as follows:
selectChange: function (question_id, ans_master_id) {
alert(question_id + " " + ans_master_id)
},
I want to get the value of option.AnswerMasterID which is in the inner loop.
selectChangemethod, you should allow your method to accept themselectChange(id, desc) { console.log(id, desc)}and It would log the data what's passed when method is fired.