javascript - How to convert the index of vue v-for into the corresponding other sequence
習慣沉默
習慣沉默 2017-05-19 10:16:31
0
2
616

Now we encounter this situation:


If I want to show this form, 0,1,2,3 should be replaced by ABCD, but the index reads 0,1,2,3. What is the answer? How to solve this situation

習慣沉默
習慣沉默

reply all(2)
迷茫

You can save the corresponding relationship, as shown below:

给我你的怀抱

The data is converted before rendering

//转换数据
let option=['A','B','C','D']
// 原始数据
let data=[
    '看见厚大司考',
    '大叔大婶大所多',
    '大叔大婶大所大所多',
    '大叔大婶大所大多'
]

let newDatadata.map((item,index)=>{
    return option[index]+''+item
})
console.log(newData)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!