v-for 迈不过友情╰ 2022-12-22 06:23 91阅读 0赞 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script> <title>v-html</title> <style> li { width: 100px; list-style-type: none; background-color: aquamarine; margin-top: 5px; } </style> </head> <body> <ul id="test"> <!-- v-for= '值 in 集合' --> <!-- v-for= '(值 , 索引) in 集合' --> <li v-for='(element,index) in data'> { {element+'的索引值为'+index}}</li> </ul> </body> <script> let app = new Vue({ el: '#test', data: { data: [1, 2, 3, 4, 5, 6, 7] } }) </script> </html> ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxNzY3OTQ1_size_16_color_FFFFFF_t_70_pic_center] [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxNzY3OTQ1_size_16_color_FFFFFF_t_70_pic_center]: /images/20221120/c5156e612ea44b64b30f1614c21e3dd4.png
还没有评论,来说两句吧...