如何在下面的代碼中獲得方法selectChange
中的row.question_id
和option.AnswerMasterID
的值?我正在使用Vue.js v2。將值發送到VueJS中的方法2
<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>
我的方法如下:
selectChange: function (question_id, ans_master_id) {
alert(question_id + " " + ans_master_id)
},
我想要得到的option.AnswerMasterID
的值,它是在內部循環。
什麼你到底是什麼意思?由於您將2個參數傳遞給了'selectChange'方法,因此您應該允許您的方法接受它們,並在記錄方法被觸發時傳遞的數據。 –
看起來沒問題。有什麼問題嗎? – wostex
我想要option.AnswerMasterID – sm12