How to display dynamic arrays in v-for loops in vue?

requirements description:

datainput
selectselect...:


related codes

data:

data() {
    return {
    
        NERole:["SR","CPE","AGG_LSW","ACC_LSW","OLT","DSLAM","MxU","MSAN","ONT"],//selectoption
        protocol:["TELNET","SSH"],
        agentPath:[],
        modifyDialog:true,
        modifyObj:{  //html
             basicInfo:{
                 NEGroup:"",
                 NERole:""
             }
        },
<div v-for="item,key in modifyObj">
    <el-row class="modify-item" v-for="i,k in item">
        <el-col :span="6" v-text="computedStr(k)"></el-col>
        <el-col :span="15">
            <div v-if="k==="NERole"||k==="protocol"||k==="agentPath"">
                <el-select style="width: 100%" v-model="modifyObj[key][k]" :placeholder="$t("collector.choose")">
                    <el-option :key="b" v-for="a,b in this[k]" :label="a" :value="a"></el-option>
                </el-select>
            </div>
            <div v-else>
                <el-input :type="k==="password"?"password":"text"" v-model="modifyObj[key][k]"></el-input>
            </div>
        </el-col>
        <el-col :offset="1" :span="2">
            <el-button @click="deleteItem(key,k)" size="mini" type="danger" icon="el-icon-delete" circle></el-button>
        </el-col>
    </el-row>
</div>

what result do you expect? What is the error message actually seen?

because the key in modifyObj is the same as the name used to traverse the value used to generate option, I want to pass k directly to this,
as a dynamic attribute, but the result is that the corresponding array is not available in the select box.

Please do not hesitate to comment ~

Mar.18,2022

maybe this will enlighten you: https://zhuanlan.zhihu.com/p/.


after being instructed by my colleagues, I wrote a method to deal with the value of k:

html:

<el-select style="width: 100%" v-model="modifyObj[key][k]" :placeholder="$t('collector.choose')">
    <el-option :key="b" v-for="a,b in handleKey[k]" :label="a" :value="a"></el-option>
</el-select>

methods:

handleKey(key){
    return this[key]
}
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-1e4975f-432e8.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-1e4975f-432e8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?