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

前端 未结 6 1187
星月不相逢
星月不相逢 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:26

    I have solved it with Dov Benjamin's help like that:

    • {{ object.price }}

    And another method, for both V1.x and 2.x of vue.js

    Vue 1:
    
    

    {{ item }}

    Vue2: // Via slice method in computed prop

    {{ item }}

    computed: { filteredItems: function () { return this.items.slice(0, 10) } }

提交回复
热议问题