我在数据数组中有一个值列表。我想显示前两个值(0 和 1),并显示按钮 show_more。如果单击该按钮,则会显示另一组值 (2, 3),然后必须单击该按钮才能显示更多数据。
请看下面的代码:
<div id="app">
<h2>List:</h2>
<div v-for="(d, index) in data">
<!-- display 0 and 1, then after a button is clicked, display 2 & 3,
and then a button is clicked, display 4 & 5, and so on.. -->
{{ d }}
</div>
</div>
<script>
new Vue({
el: "#app",
data() {
return{
data:[0,1, 2, 3, 4, 5, 6, 7, 8, 9]
}
}
});
</script>