有没有办法在 v-for 循环中增加 slice 方法?

Is there a way to increment the slice method in v-for loop?

这听起来可能无法实现,但我很好奇是否可以调用 slice 方法 在 v-for 循环中,在调用函数时增加切片值。它就像一个 LoadMore 函数,当您单击一个按钮时它会加载更多数据。就像我有

<div v-for="(itm, index) in stockList.slice(0, 5)" :key="itm.stockId">
    ...   
</div>
<input type="button"  v-on:click="ShowMore"  />

方法:

ShowMore(){
....// increment the slice in the v-for loop binding
counter = counter + 5.
this.stockList.slice(0, counter);
}

类似的东西...那可以实现吗? 谢谢

<div v-for="(itm, index) in stockList.slice(0, comCounter)" :key="itm.stockId">
    ...   
</div>
<input type="button"  v-on:click="ShowMore"  />

方法:

ShowMore(){
....// increment the slice in the v-for loop binding
mapCredential.state.comCounter = this.comCounter + 5;
this.comCounter = mapCredential.state.comCounter;
}

借助 Vuex 状态变量。增量计数器正在工作。