我正在嘗試傳遞 v-for 的索引,以便我可以更改一些值,我正在動態添加醫生團隊成員,并且我有此文件輸入來添加他們的圖像,盡管當我添加醫生時它只會更改第一個一個圖像,因為它總是發送第一位醫生的索引,如果有幫助的話,文件輸入位于 v-for 循環內。<v-file-input hide-input class="d-none" id="doctorImage" truncate-length="1" @change="doctorImage($event, index, doctor)"></v-file-input>方法:doctorImage(e, index, doctor) { console.log(index) this.doctors[index] = { image: URL.createObjectURL(e), imageData: e, name: doctor.name, specialty: doctor.specialty } this.doctorChange += 1 }索引始終為0,盡管當我在醫生卡上動態創建索引時它顯示索引號,為什么會發生這種情況?
Vue如何將索引從v-for發送到方法
至尊寶的傳說
2023-09-28 09:37:08