Vue.js入门(六)---使用computed进行v-for倒序
<div class="grid-content bg-puprple-light" v-for="(value, key, index) in reverseblogList.slice((currentPage-1)*pageSize,currentPage*pageSize)"><el-row type="flex" class="row-bg" justify...
·
<div class="grid-content bg-puprple-light" v-for="(value, key, index) in reverseblogList.slice((currentPage-1)*pageSize,currentPage*pageSize)">
<el-row type="flex" class="row-bg" justify="space-around">
<el-col :span="20">
<div class="grid-content bg-puprple-light">
<h1>{{ value.fields.title }}</h1>
<h4>{{ value.fields.timestamp }}</h4>
<p>{{ value.fields.body.substring(0,100)+'......' }}</p>
</div>
</el-col>
</el-row>
</div>
把你要反转的json对象使用reverse()函数反转
computed: {
reverseblogList() {
return this.blogList.reverse();
}
},
更多推荐
已为社区贡献19条内容
所有评论(0)