How is the index value of the v-for loop in the tag in Vue passed to the external method as a parameter?

<div> 
    <div class="form-group height35">
        <label  class="col-sm-3 control-label paddingRight0 fontStyle"></label>
        <div class="col-sm-8 paddingLeft0">
            <select name="" id="" class="form-control" v-model="chooseCurrentModuls">
                <option :value="item.chapterName" v-for="(item,index) in chooseModules" :key="index">{{item.chapterName}}</option>
            </select>
        </div>
    </div>
</div>
<button slot="footer" type="button" class="btn btn-default sameButton sureButton" @click="sureAddToReport()"></button>
<button slot="footer" type="button" class="btn btn-default sameButton cancelButton" @click="openJoinReport=false"></button>

as in the code above, when you select the template drop-down menu, you want to pass the index of the selected value to the sureAddToReport method that is triggered when the OK button is clicked. But now I don"t know how to pass index to the outside world. You can"t get the value of key by using getAttribute.
how to deal with this problem and pass index to external methods?

< hr >

add that chooseCurrentModuls= chooseModules [index] .chapterName, the reason why you do not need to get the chooseCurrentModuls is because it is found in the test that this value can have the same name, which will lead to errors in other parameters passed to the background. You need to use index to determine other parameters in chooseModules

.
Apr.02,2021

isn't this chooseCurrentModuls already recorded? The
sureAddToReport method can get the object via chooseModules.filter (_ = > _ .chapterName = this.chooseCurrentModuls) (you can also save filter overhead by chooseModules , map ).

of course, you can also directly bind the value of option to item, so that you can get the object directly.


select can already get the ID, just match chooseModules . You don't need to record index,. Anyway, the purpose of recording index is to find the selected item

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41ff7-2c5f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41ff7-2c5f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?