评论回复,加载更多,,如果回复内容过多,最多显示3条,点击更多回复再刷3条

This commit is contained in:
daihh
2022-11-24 21:23:45 +08:00
parent 406e6f3c34
commit fe3a506419

View File

@@ -113,7 +113,7 @@
</div> </div>
<!--回复内容--> <!--回复内容-->
<div v-if="com.replyList && com.replyList.length>0"> <div v-if="com.replyList && com.replyList.length>0">
<div v-for="(reply,replyIdx) in com.replyList" :key="reply.id" v-if="com.showAll || replyIdx<3"> <div v-for="(reply,replyIdx) in com.replyList" :key="reply.id" v-if="replyIdx<com.showNum">
<div class="comment" :class="replyIdx===com.replyList.length-1 ? 'comment-last' : ''"> <div class="comment" :class="replyIdx===com.replyList.length-1 ? 'comment-last' : ''">
<div class="comment-top"> <div class="comment-top">
<div class="comment-author"> <div class="comment-author">
@@ -159,7 +159,7 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="!com.showAll && com.replyList.length>3" style="padding-left: 45px;padding-bottom: 10px;" @click="loadReplyMore(com)"><span style="color: #9e9e9e;cursor: pointer; border-radius: 5px;border:1px solid #cccccc;padding: 5px 10px;font-size: 14px;">加载更多&gt;&gt;</span></div> <div v-if="com.replyList.length>com.showNum" style="padding-left: 45px;padding-bottom: 10px;" @click="loadReplyMore(com)"><span style="color: #9e9e9e;cursor: pointer; border-radius: 5px;border:1px solid #cccccc;padding: 5px 10px;font-size: 14px;">加载更多&gt;&gt;</span></div>
</div> </div>
</div> </div>
</div> </div>
@@ -384,7 +384,8 @@
}, },
methods: { methods: {
loadReplyMore(item){ loadReplyMore(item){
item.showAll=true; item.showNum=item.showNum+3;
//item.showAll=true;
}, },
loadMore() { loadMore() {
this.pageIndex +=1; this.pageIndex +=1;
@@ -455,6 +456,7 @@
let ids=[]; let ids=[];
let allList=[]; let allList=[];
res.result.list.forEach(item=>{ res.result.list.forEach(item=>{
item.showNum=3;
item.answers=item.replys; item.answers=item.replys;
item.showAll=false; item.showAll=false;
item.avatar=''; item.avatar='';