Vue Js - Loop via v-for X times (in a range)

前端 未结 6 1054
星月不相逢
星月不相逢 2021-01-30 04:54

How can I repeat a loop via v-for X (e.g. 10) times?

// want to repeat this (e.g.) 10 times

6条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 05:37

    You can use an index in a range and then access the array via its index:

    • {{ shoppingItems[index].name }} - {{ shoppingItems[index].price }}

    You can also check the Official Documentation for more information.

提交回复
热议问题