我的vue有一个v-for
圈.js应用程序:
<div v-for="(word, index) in dictionary">
// break if index > 20
<p>{{word}}</p>
</div>
我想在渲染20个单词后打破循环.我怎样才能做到这一点?
我的vue有一个v-for
圈.js应用程序:
<div v-for="(word, index) in dictionary">
// break if index > 20
<p>{{word}}</p>
</div>
我想在渲染20个单词后打破循环.我怎样才能做到这一点?
可以在循环开始之前操作数组
<div v-for="(word, index) in dictionary.slice(0,20)">
<p>{{word}}</p>
</div>