Home  >  Q&A  >  body text

javascript - How to convert the index of vue v-for into the corresponding other sequence

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

習慣沉默習慣沉默2690 days ago618

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-19 10:18:31

    You can save the corresponding relationship, as shown below:

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:18:31

    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)

    reply
    0
  • Cancelreply